Android :: Modifying Components On Widget From Activity

Apr 17, 2010

On my widget I'm having a button and a textView. When clicking that button some data is registered and I want the TextView to be updated. However I can't get to the TextView instance from within my Activity it seems.

Android :: Modifying components on widget from activity


Android :: Modifying Android Seekbar Widget To Operate Vertically

Mar 10, 2009

I'm trying to get a vertical seekbar going with the emulator, but I'm sort of stuck. I can get the seekbar to display the way I want it to, and I can get the progress to do what I want, and I can modify the onTouchEvent to get the thumb to go vertically instead of horizontally. What I can't do is get the thumb to move outside of the default 29 horizontal pixels without using setThumbOffset(). This in itself isn't a problem. The problem is coming from the fact that I don't understand the thumb Offset at all -- I guess. I think I could (properly) resize the widget, which I am pretty sure I'm not doing right. Or maybe I could just use the thumb Offset if I could figure it out. Since I can calculate the progress correctly I thought I would just use a linear function of progress * (get Top() - get Bottom()) of the widget but that doesn't seem to do it. But I can't figure out what the offset is centered around. As a somewhat aside, I am really unsure if what I am doing in onSizeChanged() is sane or if it's going to bite me in the ass later
on. Here's the main.xml layout:
<?xml version="1.0" encoding="utf-8"?>
<Linear Layout xmlns:android="http://schemas.android.com/apk/res/android"
And the class (ignore the debugging junk):
import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.SeekBar;

public class Slide Bar extends Seek Bar {

private int oHeight = 320, oWidth = 29;
private int oProgress = -1, oOffset = -1;;
private float xPos = -1, yPos = -1;
private int top = -1, bottom = -1, left = -1, right = -1;
public Slide Bar(Context context) {
super(context);}

View 4 Replies View Related

Android :: App Widget Configure Activity Opens Main Activity

Jan 10, 2010

I hav an app that is like a relational database. There is a main app activity that users manage things with. There is also a widget that will display important info and add data to the database. When the widget is clicked, a configure class displays a way for the user to edit data. When the configure activity is done, the widget is updated and instead of going back to the home screen, the apps main activity is started. I can't find where the main activity is being called from. Wouldn't I have to create an intent and start Activity() to get this behavior? When done updating, I want the home screen and not my app.

View 3 Replies View Related

Android :: Can ListActivity / Tab Widget Be Use In One Activity?

Aug 9, 2009

My activity have to use List and Tab widget, one is left side,the other is right side, I means layout, but use List must to extends ListActivity, and use Tab widget must to extends TabActivity?

View 7 Replies View Related

Android :: Call Activity From Widget?

May 30, 2009

I've read through the Application Fundamentals three times today (and I had done so before), but I still can't quite wrap my ahead around the task concept. Or I guess I thought I understood it, but usually, the results I am seeing don't match up to what I would expect to happen (maybe a tool to see the current tasks/activities etc. for debugging purposes would be a nice addition).

I have multiple widgets from my provider in the Launcher desktop, and each is using a PendingIntent with a different URI as data (so they should be separate intents) to open an Activity.

I want there to be only once concurrent instance of this Activity that the user can access. So clicking the widget (1) , pressing HOME (2), clicking a different widget (3), pressing BACK (4) should bring the user back to the Desktop.

Now I did manage to do this using launchMode="singleTask" - the existing instance is brought to the top, onNewIntent() is called and I am pretty satisfied with it.

However, supposedly there are other ways to achieve an equivalent effect (say with having the activity restarted), and I'd like to understand why I don't seem to be able to get them to work: In every case, instead of seeing the home screen after step (4) (after pressing BACK), I see the *previous* instance of the Activity.

For example, if I read this correctly:

"There's another way to force activities to be removed from the stack. If an Intent object includes the FLAG_ACTIVITY_CLEAR_TOP flag, and the target task already has an instance of the type of activity that should handle the intent in its stack, all activities above that instance are cleared away so that it stands at the top of the stack and can respond to the intent. If the launch mode of the designated activity is "standard", it too will be removed from the stack, and a new instance will be launched to handle the incoming intent." http://developer.android.com/guide/topics/fundamentals.html

Then simply using using the following code to start my Activity from my widget should do what I want, no?

CODE:............

So in (3) My activity should be launched using FLAG_ACTIVITY_NEW_TASK by the launcher, which due to process affinity would find the existing task (which would consist of a single instance of my Activity), and launch the new instance on top of it. This explains what I am seeing. Why doesn't FLAG_ACTIVITY_CLEAR_TOP cause the existing instance in the task to be replaced?

Even setting android:launchMode explicitely to "standard", as mentioned in the doc quote above, this doesn't seem to change things.

I also tried android:finishOnTaskLaunch="true", but the behaviour is the exact same was just described with FLAG_ACTIVITY_CLEAR_TOP (which seems to be the exact same as when doing neither and really starting an activity without any special attributes).

I should mention that If I click the same widget in (3) as I clicked in (1), i.e. using the same PendingIntent twice, I do get the previous instance brought to the front (not restarted), but again, regardless of whether FLAG_ACTIVITY_CLEAR_TOP or finishOnTaskLaunch are being used.

I find this especially strange since the docs about tasks don't seem to mention the intent itself being relevant at all. Application Fundamentals does at one point say "For the default "standard" mode, a new instance is created to respond to every new intent", but it's not clear what "new intent" means then. Is triggering a PendingIntent multiple times through a widget not multiple "new" intents then?

I also tried various combinations of the other related options, but pretty much got nowhere.

View 2 Replies View Related

Android :: Update A Widget From An Activity?

Sep 22, 2009

I have been looking for a way to update a widget asynchronously, for example, when the phone receives a text message. I have a broadcast receiver set up with code that runs upon receiving a message. I also have an AppWidgetProvider that is set up and running. It seems like the *only* way a widget can be updated is upon its interval, or when the user interacts with it. Is there any way to update a widget upon a system event?

View 6 Replies View Related

Android :: Update Widget From Activity

Nov 1, 2010

I have a widget, its setup so that when I click on it, it opens some settings in an activity.

CODE:................

This configures some settings for the application. What I want to achieve is to have the widget update its view to reflect the changed settings when the Activity I launch closes. Using the update interval or any other type of polling isn't appropriate for this.

I've seen a couple places here and in the android docs this code used:

CODE:...................

But I don't know how to get the mAppWidgetId value. I tried following the example for a widget configuration activity here http://developer.android.com/guide/topics/appwidgets/index.html, but in the following code,

CODE:............

Extras is always null, so I never get the AppWidgetID.

View 1 Replies View Related

Android :: Widget - Update From My Activity?

Nov 8, 2010

I have added a widget and instead of updating it every xxx minutes, i want to update it only if in my activity something is changed. But how can i call the onUpdate Routine of my widget from my activity?

View 3 Replies View Related

Android :: Embed An App Widget In An Activity?

Mar 19, 2010

I want to embed the analog clock in my application.

I use <AnalogClock android:layout_width="wrap_content" :layout_height="wrap_content" /> in my layout XML file, but the clock's appearance is different from the one added in Home screen. I know I can copy the AlarmClock's images to my project. And in xml file, set the android:dial, android:hand_hour,and android:hand_minute to my project's images. But I want to know is there a way to directly reference the resource in the AnalogClock?

second question, Can I add the app widget from code? I tried use following code to add a appwidget, but it seems the getAppWidgetIds don't work?

CODE:...................

View 3 Replies View Related

Android :: Run A Prefs Activity From My Widget

Mar 11, 2010

I've made an application for network monitoring "Myapp" under com.domain.monitor package and which contains a Prefs-activity . After that , I made a widget to let the admin keep an eye on hosts status "the information is presented as a graph in the widget" , also the widget has it's own package different of the Myapp's one & has a unique Prefs button ! (complicated Crying or Very sad , I know)

The Problem : Is there any way To run Myapp and show the prefs- acitvity by clicking on the widget's buttton !

View 3 Replies View Related

Android :: Programmatically Update Widget From Activity?

Aug 11, 2010

I know it's possible, but I can't figure out a way to trigger an update of my widget from the main activity. Isn't there some general intent I can broadcast?

View 1 Replies View Related

Android :: Launching An Activity From Widget Click

May 19, 2009

I am working my way through oh my first widget (so this is 1.5, obviously) and I'm stuck. I've poked around a problem involving the launch of an Activity when clicking on a widget. Scenario: User drags widget on home screen without prior launch of the Activity in question. I am following this post: http://android-developers.blogspot.com/2009/04/introducing-home-scree... Instead of launching the browser through ACTION_VIEW, I am trying to launch an Activity by class. I've toyed around with different Intent settings, but no luck.

View 7 Replies View Related

Android :: Launching An External Activity From Widget

Dec 22, 2009

I have written a widget that cycles through a series of movie poster images with next/prev buttons.This works.There is another button on the widget that needs to launch an external activity, sending it the name of the shown movie.The other activity is not in the same namespace, package or eclipse project as the widget.It is written by another developer and its apk is installed on my emulator.

View 7 Replies View Related

Android :: Change Widget Text In Another Activity

Apr 8, 2010

Suppose I have ActivityA and ActivityB, also suppose that ActivityA is active. I need to:

Programmatically set a text of EditText in ActivityB from ActivityA
Launch ActivityB

Here's my code:.............

ActivityB starts, but without any text in txtResult.

View 1 Replies View Related

Android :: Add Widget Configuration Activity To Launcher?

Oct 17, 2010

I have a widget with a configuration activity.

Currently the configuration launches when you click on the widget.

I want to add the configuration as an app icon to the launcher.

The problem is that when the configuration launches on click, I get a specific widget id , so each widget instance can have a different configuration.

What will happen if I start the activity from the launcher?

I wont be able to show multiple configurations on the same activity.

View 1 Replies View Related

Android :: Display Widget Inside Activity?

Jun 2, 2010

I was wondering if there is a way to show a widget that I have created inside an activity. I have a weather widget and I also have an app I am working on that I would like to include weather reports in. Is there a way I can just re-use the widget code and make it show inside the weather activity?

View 4 Replies View Related

Android :: Use An Activity Or A Service When Using A Button In A Widget?

Aug 9, 2010

I have made a Android Widget which displays two articles (title + image). In addition to this, I have buttons for flipping backward and forward through the articles. What I don't understand is how I can change the Widgets RemoteViews when the buttons are pressed. Which should be one of the most basic operations in a widget, however, I can't seem to figure it out.

So... Can I do this with just a OnClickListener in the AppWidgetProvider? Or do I have to create an Activity without a window (visibility = false)?

View 1 Replies View Related

Android : How To Listen A Closed Activity From A Widget

Oct 8, 2010

I have a widget that launches an activity, but when the activity finishes using the finish() I don't know how my widget can know about it since I can't override onActivityResult() which seems like the only way to listen when an activity closes...?

View 2 Replies View Related

Android :: Widget Configuration Activity - Update Request

Sep 18, 2010

I'm having an issue with a config activity for a widget. According to the dev docs, if I specify a configuration activity than the onUpdate method of the AppWidgetProvider doesn't get called until after you request an update once you've completed the configuration activity. For me its happening in reverse, the onUpdate method of the AppWidgetProvider gets called first, followed by the configuration activity. Then the onUpdate method is never called after completion of the config activity even though I request it explicitly. I tried with level 4 and level 7 API, same result. Here is some of the source:

Manifest:
<?xml version="1.0" encoding="utf-8"?> <manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.chris.android.swidget"
android:versionCode="1" android:versionName="1.0">
<application android:icon="@drawable/app_icon" android:label="@string/app_name">
<activity android:name=".SWidgetConfigure">
<intent-filter> <action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter> </activity>
<receiver android:name=".SWidgetProvider" android:label="@string/ widget_name">
<meta-data android:name="android.appwidget.provider" android:resource="@xml/swidget_info"/> <intent-filter> <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter> </receiver>
<service android:name=".service.PUpdateService" />
</application> <uses-sdk android:minSdkVersion="4" />
<uses-permission android:name="android.permission.INTERNET" />

</manifest>
swidget_info.xml: <?xml version="1.0" encoding="utf-8"?> <appwidget-provider
xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="294dp" android:minHeight="72dp"
android:updatePeriodMillis="86400000"
android:initialLayout="@layout/swidget_layout"
android:configure="com.chris.android.swidget.SWidgetConfigure" >
</appwidget-provider>

I can include source of the onUpdate method from the AppWidgetProvider activity and the onCreate method of the configuration activity if necessary, but they are both being called find its just the order they show up on the emulator is wrong.

View 5 Replies View Related

Android :: Identifying Which Widget Click Is Launching Activity?

Jun 8, 2009

I m creating my own widget widget initial layout contains one button.when i click on that widget button it shud launch the specified activity using service everything is working fine..but the problem comes when there are 2 or more widget on home screen when i clicking on any one of them i m not able to specify with widget is launching the activity.

View 6 Replies View Related

Android :: How To Decide Widget Size In Configure Activity?

Feb 7, 2010

in HTC Sense, we can choose widgets of different size after tapping a single entry in the widget list. Is this also possible in pure Android Framework? I have tried to modify the widget's size in the configure Activity, but failed.

View 2 Replies View Related

Android :: Widget : Get Data From Configure Activity To AppWidgetProvider?

Feb 14, 2010

I'm writing a widget where i first have a configure screen where the user makes a selection. Then I want to pass that data on to the actual widget. This must be really simple but I just can find out how to do it.

View 2 Replies View Related

Android :: Starting Activity Witouth Window From Widget

Apr 17, 2010

I recently (yesterday in fact :)) started creating widgets.

So my first widget I want to create is something like: * A 2x2 widget * Containing 2 buttons * Button

1: Register current time and location * Button

2: Open up an activity where configuration can be modified, registered times and location can be viewed,...

Now the problem for me is button 1. As I only try to do some registration data (so no further user input required after pressing the button) I would like to just show a loading bar and after wards Toast a message to screen, or a popup if anything goes wrong.

This is what I do now:

CODE:...........

So what happens: I click the button, a plain black screen pops up (Altough I did not specify a layout upon creating the activity), and after my work is done the Toast shows up and the activity gets 'killed'. Basically that is what I want to do except for the black screen to show up. Is it possible not to show a screen upon creating the activity?

View 2 Replies View Related

Android :: Clock - Which Is In The Destop - Widget Or Application - Activity?

Apr 22, 2009

I have a question for widget support on Android. I found clock in the android destop, and want to know if it is a widget or application (Activity)? If it is a widget, what about the widget engine (runing enviroment) of android?

View 4 Replies View Related

Android :: Using Customized UI Components In XML

Oct 9, 2009

When I use customized components in XML, could I use a short name of component instead of a fully qualified class name? I wonder if some configuration file exists to do that work.

For example, my customized components is ex.object.RoundRect,

I should use it in xml file like this: <ex.object.RoundRect android:id="@+id/mainRoundRect01" ... />

But

I want to use it like this: <RoundRect android:id="@+id/mainRoundRect01" ... />

Is it possible? Is there a configuration file that can map the fully qualified class name to a short name?

View 2 Replies View Related

Android :: Rich UI Components

Apr 11, 2010

I am a newbie to android development and looking for developing rich UI based applications. But the tools like Droid Draw only support primitive UI elements. How do I bring in a better UI? Any sample or references or books would help.

View 2 Replies View Related

Android :: Updates To Several Different Components In The SDK?

Dec 3, 2009

Earlier today, we released updates to several different components in the Android SDK. Xav announced these updates via the Android Developers blog: http://android-developers.blogspot.com/2009/12/android-sdk-updates.html. If you want to follow the blog via Twitter, you can now do so via [url]

In addition to the new tools and platforms, there's one other important change that I wanted to point out. We've added additional clarification to the docs about android:maxSdkVersion and what effects it might have on your app if you use it. You can see these details here: [url]

View 1 Replies View Related

Android :: Trying To Launch Activity / When Home Screen Widget Is Pressed

Dec 20, 2009

I'm trying to do something which really ought to be quite easy, but it's driving me crazy. I'm trying to launch an activity when a home screen widget is pressed, such as a configuration activity for the widget. I think I've followed word for word the tutorial on the Android Developers website, and even a few unofficial tutorials as well, but I must be missing something important as it doesn't work.

View 6 Replies View Related

Android :: Passing Aray List To Next Activity In Widget Application

May 20, 2010

I am trying to create app widget.In this widget I have added one image button.If i click on this button i should pass list of object to next activity.Before passing this list to activity I am converting it to parceable list and adding it to bunddle and puting that bundle to intent.This logic is working fine in android 1.6, but this is not working in Android 2.1.In android 2.1.I am getting Null pointer excepion when I try to access this list in next activity.To solve this problem I tried to pass only String data through bundle,in next activity String is displaying properly,but when I try to pass list,then only i am not getting list in next activity.

View 5 Replies View Related

Android :: Widget Starting Service Also Starts Main Activity

May 3, 2010

I have a widget that is supposed to start and stop a service (start it when it's not running, stop it when it is). This is working fine, however, each time the service is started, my app's main activity is also launched, which I don't want from the app's manifest, it works as I want it to (without launching the main-activity, just the service), but then I obviously don't have a main activity anymore.This is how I start the service (I would assume this is the normal way, and I can't see any reference to what might cause the MAIN intent to fire).

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved