Android :: Triggering OnCreate With A Non-null Bundle (or OnRestoreInstanceState) From The Emulator
Feb 16, 2010
I've recently done quite a bit of work on saving instance state and restoring using parcelables for custom data structures. My problem is that I don't know how to test this functionality on the emulator. I can trigger calls to onPause and onStop for my activity (if I navigate out of it) but never onDestroy. So, whenever my app starts up, it starts with a null bundle. I've never had onCreate with a non-null bundle and I've never had onRestoreInstanceState getting called. how I can test the restore state functionality from the emulator?
View 2 Replies
Jun 10, 2010
My app launches the camera to allow the user to capture a picture. Sometimes this causes the OS will kill my App to free up memory for the camera. Once the picture is taken, my app starts back up where it left off using the Bundle I saved in onSaveInstanceState(). My app had a bug where in the code that restores the state. Is there anyway that I can simulate or test this case to make sure I am restoring correctly now? It seems I am having trouble making this happen when I want to test it.
View 4 Replies
View Related
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
Oct 29, 2012
I've gone through the Notepad Tutorials and they are all working on my virtual device. I am now stuck in the midst of trying to write my own Android app.
My setup:
Windows 7 SP 1 64-bit
Eclipse Indigo Service Release 2
Android Development Tools 16.0.1.v201112150204-238534
Android Virtual Device Platform 2.3.3, API Level 10, CPU/ABI ARM (armeabi)
The app is about as simple as they come - you enter a number, it divides it by another number and displays the result.Here is the code involved:
AndroidManifest.xml:
Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.driving"
android:versionCode="1"
android:versionName="1.0" >
[code]...
By the time DrivingTimeEstimator's onCreate() method gets executed, the Bundle object (savedInstanceState) is null (which I'm guessing is what leads to mMiles being null, which throws a NullPointerException and kills everything).
View 3 Replies
View Related
Jun 25, 2010
Perhaps I'm misunderstanding how Intents and intent-filters work, but it seems to me that this should be a strait-forward case. However it's not working. Here is the Intent I'm sending:
Intent i = new Intent(Intent.ACTION_VIEW);
i.setType("vnd.android.cursor.item/vnd.connectsy.event");
startActivity(i);
And here is the intent-filter:
<activity android:name=".events.EventView">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<data android:mimeType="vnd.android.cursor.item/vnd.connectsy.event" />
</intent-filter>
</activity>
And finally, the error I'm receiving:
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW typ=vnd.android.cursor.item/vnd.connectsy.event }
View 1 Replies
View Related
Jul 3, 2010
I've noticed that no apps are running according to Task Killer. I do NOTHING on my phone and look at Task Killer again and see that several applications are NOW running in the background. Is there anyway of learning what is triggering them to launch ?
View 2 Replies
View Related
Nov 9, 2010
Is there a way to manually trigger the code inside a LocationListener's onLocationChanged method? It should receive a Location object with the last known location, I guess.
View 2 Replies
View Related
Nov 11, 2010
I have a spinner and its adapter. I have a customized the list and an the spinner view.
View 2 Replies
View Related
Aug 31, 2009
The App I'm trying to work on requires that when a special combination of keys are pressed ( irrespective of the keypad being locked ) a service / app is triggered.
How can I achieve this? My app's whole idea hinges on this particular part to work.
I am not here to take a "no" for an answer. If you are going to tell me that its not possible, atleast include an explanation as to why its not possible.
View 7 Replies
View Related
Jul 21, 2010
Wondering here if there is a way I could trigger an event, so that any library listening for these events (e.g. jQTouch, Sencha touch, iUI, ... ).
If I could extend or use jQuery for such task e.g. $(...).trigger('event') that would be great to know.
Usage example:
I need to debug a few web apps by simulating multi touch with my mouse. This seems a little complicated, so if I could trigger the multi-touch events using Javascript I could therefore test the app more efficiently.
View 2 Replies
View Related
Jun 4, 2010
Way too sensitive, constantly triggering them. I'd like to see an app that puts in like a 2ms (or adjustable) delay before they respond. With "hard" buttons you actually have to press them (like my MyTouch 3G), with these if you so much as fast 6" from them they trigger.
View 34 Replies
View Related
Jun 3, 2013
I have a rogue app that is playing a notification sound every time I place my HTC One X into the car dock. It's only just started happening and I've removed any news apps that I've recently installed but it still happens. It's there an app written or is able to that can show which apps trigger sounds so u can hunt down the cause?
View 2 Replies
View Related
Aug 8, 2010
My doctor's office has an appointment computer that calls with appointment reminders. When one picks up, it plays a message and asks you to press a number if one can accept responsibility for the appointment. If you don't pick up, it's supposed to try again later.
View 2 Replies
View Related
Mar 20, 2013
I'm getting beat down with GTALK_ASYNC_CONN wakelocks while on my work's AP.... the specific WL is :gtalk_async_conn com.google.android.gsf.gtalkservice.androidendpoint.... something everyone has been complaining about recently, and I never saw it until recently (now that I got up to 4.1.2 a short time ago.
Is there a way to determine exactly who is generating that WL? It's not related to GTALK, as the WL name incorrectly leads us to believe, but it must be google, and I only see it fire when the Wi-Fi is connected and in use. It's non-existent when I'm on Mobile. It comes and goes, sometimes chugging wake time like its cheap beer, othertimes it's dormant, and I haven't been able to figure out who is using it based on the context of when it occurs.
There HAS to be a log or something somewhere that says process X is responsible.
View 1 Replies
View Related
Jan 13, 2010
Is it possible to use bundle and save the data in OnPause() lifecycle method? The scenario is i have 2 edit text and have entered some data i want to retain the data when the activity is killed and started again. his can be achieved using onSaveInstanceState() but as documentation says, this method is not a lifecycle method and hence the callback is not guaranteed. So i wanted to know if there is a way to save it using Bundle in onPause().
View 5 Replies
View Related
Jul 27, 2009
I'm well aware of onSaveInstanceState(Bundle b) and the corresponding onCreate and onRestore. What I want to do is persist the bundle somewhere simple where I'll only ever have one at a time. The functionality is to be able to resume a game from its previously stored state - not to be confused with restoring the activity during its lifecycle. I want to restore it AFTER it's been destroyed (think of turning the phone on and having a button on the game that says, "resume last game". My thoughts are that if I can just persist the bundle that I normally use for the instance state, then I should be able to reload it later upon user request. I don't want to use a provider because they seem way too over the top for what I'm doing.
View 4 Replies
View Related
Apr 8, 2010
I'd like to serialize a Bundle object, but can't seem to find a simple way of doing it. Using Parcel doesn't seem like an option, since I want to store the serialized data to file. Any ideas on ways to do this? The reason I want this is to save and restore the state of my activity, also when it's killed by the user. I already create a Bundle with the state I want to save in onSaveInstanceState. But android only keeps this Bundle when the activity is killed by the SYSTEM. When the user kills the activity, I need to store it myself. Hence I'd like to serialize and store it to file. Of course, if you have any other way of accomplishing the same thing, I'd be thankful for that too.
View 2 Replies
View Related
May 11, 2010
I'm trying to pass a bundle of two values from a started class to my landnav app, but according to the debug nothing is getting passed, does anyone have any ideas why?
View 1 Replies
View Related
Apr 22, 2009
I am implementing notification handler which logs any changes in content provider and it notifies Broadcast Receiver using custom Intent on periodic basis.But problem here is from Provider to Receiver all the values passed through Bundle.
View 2 Replies
View Related
Nov 22, 2010
I need to pass a reference to the class that does the majority of my processing through a bundle. The problem is it has nothing to do with intents or contexts and has a large amount of non-primitive objects. How do I package the class into a parcelable/serializable and pass it to a startActivityForResult?
View 4 Replies
View Related
Apr 20, 2009
What's the correct way to pass a bundle to the activity that is being launched from the current one? Shared properties?
View 2 Replies
View Related
Sep 18, 2010
I have 2 dimensions array like this: public myArrayType[][] mObjArray; I want to save it in the onSaveInstanceState method, since my array contains lot of elements I don't want to save element by element but the whole array object, what is the best way?
View 4 Replies
View Related
Apr 22, 2010
So I have a MapActivity that runs an asynchtask that occasionally updates what exactly it's displaying on the map (via a string). I originally pass this string in from the intent when the activity is first created. And then if you click on one of the drawables on the map, it opens a new activity, which can then create a new mapview (same class) with a different string setting. The problem I have is that I only want one instance of the mapview to be running at once. Thus I set android:launchmode="singletask" in the manifest. This works in that it brings the mapactivity to the front, but is there any way to send it a new intent bundle to get a new setting for the string it needs? I tried regetting the extras from the bundle, but it seems to retain the old bundle, not the new intent that was passed to it. I'm not sure I want to do startActivityForResult because the 2nd activity may or may not want to update the original activity. I hope that made sense. I can post code if necessary, but I think that should explain my situation.
View 2 Replies
View Related
Oct 6, 2009
Just upgraded my phone firmware to 1.6, and it looks like Location objects don't have satellite counts in them any more:
locMan = (LocationManager)con.getSystemService (Context.LOCATION_SERVICE); Location loc = locMan.getLastKnownLocation (LocationManager.GPS_PROVIDER); Bundle extraBundle = loc.getExtras();
extraBundle is null. So, I can't call
extraBundle.getInt("satellites").
View 5 Replies
View Related
Jan 2, 2010
I am trying to use Android's LocationManager requestLocationUpdates. Everything is working until I try to extract the actual location object that in my broadcast receiver. Do I need to specifically define the "extras" to my custom intent so that the Android LocationManager before I pass it to requestLocationUpdates so it knows how to add it into the intent, or will it create the extras-bundle regardless when it passes the fired intent to the broadcast receiver?
View 1 Replies
View Related
Sep 16, 2010
I have an application that uses a service to create an ArrayList of custom objects (MyObject) every x seconds. I then want my Activity to obtain this ArrayList. I'm currently planning on having the Service send a message to the Activity's handler every time it finishes the query for the data. I want the message to the Handler to contain the ArrayList of MyObjects. When building the method in the Activity to get this ArrayList out of the message, I noticed that I couldn't.
View 1 Replies
View Related
Nov 24, 2009
My android app fetches a JSON structure from the net. It's somewhat large, maybe 2,000 characters in length. I need to store it away when my app gets killed so I can recover it quickly. I've tried saving it to an sqlite database, but that takes about 400ms, kind of long. I wonder if it's bad practice to just dump it into the save bundle:or are we really only supposed to be putting the smallest of items in bundles?
View 3 Replies
View Related
Apr 30, 2010
This is a bit complicated to explain (and my first post), so bear with me please: I am currently trying to figure out the best way of saving my application's state in a bundle on the onSaveInstanceState event (working on a game). My application's state is based on a "world" class which contains various objects. Among these objects there is a creature object which contains bitmaps (Bitmap object)(allowing me to draw the various sprites of the creature when it's walking with more flexibility and accessibility).
Bit of creature constructor Java:
CODE:.................
After looking around for a few hours I found that serializing the world object (and all its sub-objects) was an acceptable way of saving it in the bundle. Unfortunately it appears that we can't serialize bitmaps and considering they're a part of my "creature" I can't seem to see a workaround.
Here come my questions: 1- Am I doing something fundamentally wrong? (not supposed to save bitmaps in objects? supposed to handle bitmaps in a separate class which I don't pass on the bundle and reload my bitmaps when restoring the application? ...) 2- Is there another way of passing my "world" object into my bundle (would using Parcelable work?)
View 5 Replies
View Related
Nov 9, 2009
In an Activity, I have some snippet of code that fires off a Message...
Why is the Bundle not preserved in the Message ? Who is resetting the values of the Bundle ?
View 1 Replies
View Related
Oct 5, 2010
I would like to pass a considerable sized amount of data (~1500 bytes) between two applications in Android where performance and resource allocation is a priority. The data is basically key-value pairs. The rate at which it needs to be passed from one application to another can vary from a trickle to ~50 packets within a second. I figure I can either:
Wrap all the data inside a bundle, and pass the bundle via an Intent from one application to another. I worry about the performance implications of allocating and de-allocating all that memory to store the bundles.
Write all the data to a SQLite database and provide it to the other application via a content provider. Here I worry about the performance implications of writing all that data to disk, and then having to read it back from disk when it is requested. So, which is the lesser of two evils?
View 1 Replies
View Related