Android :: Store State Information In AppWidgetProvider - Between OnUpdate Cycles

Aug 26, 2009

I know I can save information in a static attribute in a widget, however, is there a way for a widget instance to save the state information similar to the Activity onSaveInstanceState(Bundle outState) method? I don't want to write to a database for this state information.

Android :: store state information in AppWidgetProvider - between onUpdate cycles


Android : Want To Maintain Persistent State Information?

Nov 9, 2010

This usually happens when the user hits "Home", does something else, then eventually wanders back into the app - it attempts to go back to where it was before, but the application Context has mysteriously lost all its previously-saved state information (in my case, a few integers and a few Strings). I know this is a very vague question, but are there any cases (other than the user using "back" to back completely out of the application) where the application Context gets completely destroyed even though the application is not terminated? Is there a better way to maintain persistent state information?

View 1 Replies View Related

Android :: Storing Game State Information That Is Retained And Used Upon Next Start-Up

Sep 15, 2010

I have an unlockable mode in my game that is only available once the story mode has been completed. This works perfectly if the story mode is completed during a test play through, because upon returning to the main menu the bonus mode is unlocked and selectable. However when I shut down the app and relaunch it, none of the previous state information is retained and it requires you to beat the story mode again to access the bonus mode.

I use the onSaveInstanceState method to create a bundle that stores this information (ie. a boolean whether the mode is unlocked or not), but this information seems to be lost between ending the app, and relaunching it. The onCreate method takes the parameter of a savedInstanceState but yet this seems to be null.

Is there a step that I'm missing out, or doing incorrectly somewhere along the line? On a PC game I would just serialize the state into a text file and look for a special string/symbol upon initialization but I cant do that here so i thought the outState bundle you create in SIS was how you retained information for use upon next launching the app again?

View 2 Replies View Related

Android :: UI State Information - Used In Super.onCreate - Bundle SavedInstanceState - Stored

Nov 7, 2010

Where is the UI state information (used in super.onCreate(Bundle savedInstanceState)) stored and how can it be deleted from another app or command line on a rooted phone?

I need to delete the user data (username, password) of both the native Facebook app (com.facebook.katana) and the stock browser on Android (com.android.browser) on a rooted phone via command line (which I call from my own app) or elsewhere from my own app.

This is what I'm calling:

rm /data/data/com.android.browser/cache/webviewCache/* rm /data/data/com.android.browser/databases/* killall -9 com.android.browser

rm /data/data/com.facebook.katana/cache/webviewCache/* rm /data/data/com.facebook.katana/databases/* killall -9 com.facebook.katana

After I kill the facebook process, I check the running processesand there is no FB process running anymore. I then restart FB via long-press on home and choosing the FB app. Previous username/password still show on the login screen (= same screen as I left it before I killed the app). When I then press 'back' on the device, and then start the app again via home long-press / select FB, the login screen is empty.

Where do the values for username/password come when I start FB again in the first place? I assume that the login activity still retrieves the savedInstanceState, but how could that be avoided - or else, where are those UI states actually stored, in order to delete them? Shouldn't the restarted app, after all it's processes are killed, already be in a new lifecycle?

Same problem is with the stock browser: if i leave the browser and I'm on the login page of for example gmail.com where the username/password is entered (but form not submitted yet), then killing the browser process, the values (username) entered into the form will still be there after restarting the app again after it's been killed.

View 11 Replies View Related

Android : Read Local XML File / Store Information From It?

May 21, 2010

What is the easiest way to read an xml file? How is the best way to store the information from the xml?

I have tried to find a good tutorial, but I just can't get it to work..

I have an xml file in /res/xml called myxml.xml which looks like this:

<?xml version="1.0"?> <school> <student> <fname>Ola</fname><lname>Nordmann</lname> </student> </school>

I just want a simple way to read and store.

(Yes, I am a beginner

-- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

View 4 Replies View Related

Android :: Simple Client Application To Store Clients Information

Oct 12, 2010

I just purchased a Samsung Intercept through Virgin Mobile and am hoping I can find a simple application to store my clients information using it.

I am a Hair Colorist and I have been using a Sony Clie in the past to keep my client info up-to-date, but it finally died. I am hoping my new phone can keep track for me now.

Here is what I need the app to do.

1) Clients Name (so I can easily search for client)
2) Phone Number (so I can call them)
3) Address (not mandatory, but would probably be good)
4) Client's Hair Color Formula (text area where I can write down their color formula)
5) Date of last appointment (and maybe their upcoming appointment)

Does anyone know if there is something out there like this already? It seems like it should be a basic app, but I am BRAND NEW at this, so I have no idea .

View 4 Replies View Related

Android :: Name Of App That Cycles Backgrounds

Sep 20, 2009

Didn't like it at first as I had the wrong resolution of BG. Now that I want it back, I can't find it :P

View 2 Replies View Related

Android :: Manually Update AppWidgetProviders OnUpdate

Nov 4, 2009

My custom AppWidgetProvider has onUpdate method where i have logic to update RemoteViews

It is not periodically updated by system, but rather, i'd like to trigger onUpdate if something happens (in one of my app Activities). both custom AppWidgetProvider and Activities i'd like to trigger update from run with the same UID

I tried some AppWidgetManager's methods, but no luck, finally i ended with really weird solution: i'm sending broadcast with action ACTION_APPWIDGET_UPDATE and extras EXTRA_APPWIDGET_IDS which i got from AppWidgetManager

Is it a common way of updating AppWidgetProvider?

View 7 Replies View Related

Android :: Changing A Widget's Icon From OnUpdate

Dec 29, 2009

I have a widget that is meant to change its icon every time it receives the Update broadcast. However, the widget never manages to display its icon properly, displaying the text "Problem loading widget". The Logcat message is: WARN/AppWidgetHostView(612): updateAppWidget couldn't find any view, using error view
WARN/ App Widget HostView(612) : android.widget.RemoteViews$ActionException: can't find view: 0x7f060003 The code for my onUpdate is: public class ImageWidgetProvider extends AppWidgetProvider{private static final String TAG = "Steve"; public static final int[] IMAGES = { R.drawable.ic_launcher_alarmclock,/*and many more*/}; @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds){for (int appWidgetId : appWidgetIds) {Log.d(TAG, "onUpdate:"); int imageNum = (new java.util.Random().nextInt(IMAGES.length)); Log.d(TAG, Integer.toString (IMAGES[imageNum])); RemoteViews remoteView = new RemoteViews(context.getPackageName(), R.layout.widget); emoteView.setImageViewResource (R.id.image_in_widget, IMAGES[ imageNum]);Now when I hover the mouse over "R.id.image_in_widget" it brings up that its value is equal to 0x7f060003 - the view that it can't find according to Logcat. Using the second Log statement, I verified that IMAGES[imageNum] does indeed refer to a random image from the IMAGES array. (In case it matters, it comes out as a decimal value rather than a hexadecimal one.) Any ideas what I'm doing wrong? Edit: Here is the layout file for the widget, where the image_in_widget ImageView is declared.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView android:name="@+id/image_in_widget"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/

View 4 Replies View Related

Android :: OnUpdate Doesn't Get Called On Device / Way To Fix?

Feb 14, 2010

I'm new to Android development, and I'm trying to write a small widget. This code works on the emulator and the text is set to "test", but when i run it on my Nexus One it doesn't. It just appear like onUpdate isn't called. Anyone have any good idea what i'm doing wrong?

View 1 Replies View Related

HTC Desire :: WiFi Constantly Cycles On And Off

Nov 6, 2010

I've got an unbranded Desire running 2.2. Occasionally (maybe twice a week) it will go into a cycle where WiFi disables itself when connected. Once fully disabled, it enables itself again. Once it has found my home network, it obtains the IP address. At the point of connection it then disables wifi and starts the process again. Normally, it works fine. Connected, stable, just as you'd expect. Once it starts on this loop I restart the phone and it works absolutely fine. This has happened on another WiFi network other than the home network. I've got the power control widget, and since this started I've now got WiFi manager installed as well. I run locale with a scenario that turns WiFi on when I'm at home using the location power saving add-on, however this WiFi problem has occured with both locale enabled and disabled.

View 4 Replies View Related

HTC Incredible :: Froyo 2.2 Causing Reboot Cycles

Sep 5, 2010

I never really had an issue of reboots until recently, before I actually updated to froyo (week and a half or so) I started getting some random reboots.

Now I have been having some major problems, I am not sure if it is related to froyo or not, but i suddenly am getting a lot of more reboots, and when it does it will sometimes get stuck in a cycle of reboots and just keep going and going. Tonight it literally just kept rebooting over 10 times. I battery pulled multiple times and still was doing the same thing. Is there a reason this could be happening?

Yes I have done factory reset since install of 2.2, and actually right when i installed and did factory reset it got stuck in this cycle.

I have talked to verzion and they could not make it reboot so they said they could not do anything at the moment but put a note on the account.

View 5 Replies View Related

Android :: Changing Displayed State Of Views Based On Parent ViewGroup's State

Aug 11, 2010

I have a compound UI component built up from a ViewGroup containing a number of TextView, ImageView etc. components. Many of these have StateListDrawables as their images/backgrounds. Is there any way of making them select from this drawable based on the state of the parent ViewGroup rather than the component itself? Ideally I want to be able to change the visual state of all children of the ViewGroup (text colour, image etc) based on the state of the ViewGroup, preferably without having to hook up complex logical code. This seems like a fairly common sort of requirement, so I was hoping it would be straightforward in Android - am I going to be disappointed?

View 1 Replies View Related

Android :: Phone State Listener State Transitions

Feb 8, 2009

I'm a little confused by what I'm seeing with regards to phone state transitions via the PhoneStateListener. When I receive a call, this is what happens: (call comes in) RINGING -> IDLE (I pick up) OFFHOOK (I hang up) IDLE It's that first transition from RINGING to IDLE without any interaction from me (not ending the call, not answering the call) that confuses me. Do I really have to implement an idle counter to know that an incoming call has really ended? Seems like the reported phone state represents some sort of phone state that isn't the obvious one.Is this a bug or am I just not in tune with the paradigm here?

View 2 Replies View Related

Android :: Sync Information And Future Information

Jul 7, 2010

I am a Mac user (photographer/ videographer). I also rely heavily on my iPod Touch when mobile (i can often find a wifi signal when i am out and about). I use iCal on the Touch and iCal on my Mac as well as the address book on both everyday and as a Mobile Me user, my two devices sync so everything is mirrored and up to date. I also HATE AT&T for their terrible signal strength and coverage and have been a loyal Verizon customer for many years and this is why I don't have an iPhone. Okay, all that being said, is there an easy way to still use everything I love and rely on with my Mac (the calender and address book, mainly) and easily sync all of my existing information and future info to an Android based device? How easy is it to use an Android device with a Mac? I don't want to have to manually re-enter my entire address book into a new device.

View 8 Replies View Related

Android :: AppWidgetProvider - 1.5 SDK?

Apr 21, 2009

I have a general question. Is it possible to set the RemoteView of the widget to a WebView? My goal is to push real time updates to the WebView via the comet technique (HTTP long polling), similar to how Google Talk does it on the desktop browser I suppose. Do you think battery life would be significantly impacted with this approach?

View 5 Replies View Related

Android :: AppWidgetProvider And BroadcastReceiver

Oct 2, 2009

I have an app widget that extends an AppWidgetProvider to create an application widget.

I would like the application widget to be idle until an activity in my app runs; actually when a service in my app is started.

Once that service is started, I need to "wake up" the application widget and communicate with it (i.e. tell it things to display).

So I see that AppWidgetProvider simply extends BroadcastReceiver -- so does that mean:

1. I need to call registerReceiver in my service and tell it to filter for certain kinds of events?

2. Can I even do #1, or will an AppWidgetProvider *only* accept ACTION_APPWIDGET_* intents?

3. If #2 is correct, how can I communicate or "wake up" / trigger the application widget?

4. Can I send events to my app widget using sendBroadcast( intent )?

Then, my app widget has some buttons on it, I need to send an intent back to the application (or service). I see you can do that with PendingIntents, but if i send the different intents it to the same Activity, it seems to re-use the first created pending intent.

View 2 Replies View Related

Android :: Pass Value From AppWidgetProvider?

Nov 8, 2010

I would like to pass a value from the AppWidgetProvider to a service. How can I do that? This value is taken from the widget configuration. If this value changes (by going to the configuration again), how do I pass it back to the service? Is there another way to do this?

View 1 Replies View Related

Android :: Model For AppWidgetProvider

Aug 2, 2010

I have a widget that shows some data fetched from the Internet. I may have multiple widgets visible on the screen, each displaying some data, partly the same as the other widgets. From time to time I re-fetch the data from the Internet and update the widget views. I've modeled this in an MVC style: I have a model which I can invoke a "re-fetch-data" on, and which the views listen on. My questions:

A) Is it wise to let my model be a singleton?
B) Can I rely on that all widgets are served by the same AppWidgetProvider? Or may some of my widgets get served by a different AppWidgetProvider instance? Or, more generally: Is there any guarantee that there will be only one instance of my AppWidgetProvider? If there is only one instance of my AppWidgetProvider, then I could use an instance variable here for the model, and pass either my AppWidgetProvider or the model around where needed. Perhaps a better option?

C) In the AppWidgetProviders onUpdate method, can I be sure that the same "context" object is passed as argument each invocation?

View 1 Replies View Related

Android :: Updating AppWidgetProvider From Service

Jan 1, 2010

Here is my issue, I want to be able to update a specific AppWidgetProvider (home screen widget) from a custom service class. I have to build the remote view in the service because I'm also doing some networking in there, which takes some time. The problem is that I can't figure out how to update a specific widget (individual widgets can have different update intervals, using the alarm manager). If I wanted to do it from the onUpdate of the AppWidgetProvider I could just call appWidgetManager.updateAppWidget(appWidgetId, remoteView); Does anyone have any experience with this or any suggestions?

View 4 Replies View Related

Android :: AppWidgetProvider And Screen Updating?

Nov 13, 2010

I am making a clock widget for the android home screen using AppWidgetProvider. I have it calling the TImerTask class that updates all my values using this code:

@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds {
Timer timer = new Timer();
timer.scheduleAtFixedRate(new MyTime(context, appWidgetManager), 1, 1000);
}

In the TimerTasks run() I am setting a bunch of text views to the relevant values. My problem is that this seems to work fine, but it makes my home screen unresponsive, probably due to updating it every second. How do I fix this and still have it update the display at the correct time? (I only need to see minutes not seconds, but I want the minutes to change at the correct second.)

View 2 Replies View Related

Android :: AppWidgetProvider - Convenience Functions

Oct 30, 2009

It seems like the convenience functions (onUpdate, onEnabled, etc.) aren't being called in the emulator on Android 2.0. Is this a bug, or are these functions just being eliminated? It would have been nice to see this documented somewhere.

View 4 Replies View Related

Android :: Start AlertDialog From AppWidgetProvider

Aug 6, 2010

Anyone know if it is possible to add AlertDialog within a AppWidgetProvider class? Here is the code I am working on where I start the AlertDialog on onEnabled function call.

@Override public void onEnabled(Context context) { super.onEnabled(context); Log.v(TAG,"onEnabledWidget"); AlertDialog.Builder builder = new AlertDialog.Builder(context).setIcon( android.R.drawable.ic_dialog_info ).setTitle(R.string.app_name) .setMessage("This is testing") .setNeutralButton("Confirm", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { } }); alertNotSmc = builder.create(); alertNotSmc.show(); //runs when all of the first instance of the widget are placed //on the home screen .........

View 5 Replies View Related

Android :: Add App Widget Through Created AppWidgetProvider?

Jul 14, 2010

I'm slighty puzzled about how android's AppWidget machinery works. I reimplemented the AppWidgetProvider's constructor like this:

public class MyProvider extends AppWidgetProvider {
public MyProvider() {
Log.d("TEST", "Creating...")
}
public void onUpdate(..., int[] appWidgetIds) {
// updating stuff here

From what I've read in the docs, I understood that AppWidgetProvider is instantiated once, when widget of that type is added for the first time. If another widget of the same type gets added, it will be managed by exactly that provider.But I just discovered that this is not the case. For each widget I add, android creates a new MyProvider (I see that from 'adb logcat' - it prints "Creating..." for each widget)!I don't understad why. Maybe I got something wrong? Or documentation isn't clear on something. What's the reason of having appWidgetIds passed to onUpdate and other methods if each provider is managing only ONE widget?

View 2 Replies View Related

Android :: Sending Event / Intent To AppWidgetProvider

Sep 30, 2009

From a service that's running, how do I send an event or an intent to an app widget that is just sitting their idle.

View 6 Replies View Related

Android :: Accessing Elements Of Widget From AppWidgetProvider

Nov 23, 2009

I have built a widget that contains a button and an editable TextView (that behaves like an EditText) much like the native Google Search bar widget. How can I access the text that the user has typed into the TextView? In an Activity I would just use findViewById(), but of course I can't do that in the AppWidgetProvider. (I get the error message "The method findViewById(int) is undefined for the type Widget.") So I tried to solve it by using a million casts, like so: String str = (String) ((TextView)((Activity) context).findViewById(R.id.txt_input)).getText(); Unfortunately, with that line present my app crashes. What is the correct way to get references to those Widget elements? I've read all about RemoteViews and Widgets and looked for examples where somebody does this (which seems like it would be common, but I guess not) but I haven't turned up a solution. What am I missing?.....

View 8 Replies View Related

Android :: Signal An AppWidgetProvider From Service Running In Another Process

Feb 2, 2010

I am attempting to signal my widget such that it receives my new Intent from my service

The code I am using to send from the service is as follows:

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

View 2 Replies View Related

Android :: ProgressBar Doesn't Allow Control Of Visibility In AppWidgetProvider

Aug 7, 2009

I was trying to set a progress bar to View.INVISIBLE or View.GONE, or View.VISIBLE inside an AppWidgetProvider. However, it doesn't seem to want to do it. Setting visibility works fine with TextView fields or ImageView fields or ImageButtons. However, ProgressBar doesn't seem to work. It doesn't make sense that just the progress bar type isn't supported for controlling visibility. Has anyone else seen this problem?

View 4 Replies View Related

Android :: Way To Display A ListView On A Home Widget With AppWidgetProvider?

Jun 5, 2010

I would like to create a Home Widget containing a ListView, but I don't know if this is possible and if it is, how to do it. I was using a ListActivity and it was pretty simple, but can't figure out a way to do it using AppWidgetProvider.

View 1 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







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