Android : OnResume Called While Device Is Off For Hours
Mar 19, 2009
I have documented cases of an activity's onResume method getting called HOURS after the G1 is - well, not asleep, since a WakeLock is in use, but "idle" with the screen off (indeed, it had been off in one case for 6+ hours).
View 2 Replies
Sep 15, 2010
I have a TabActivity with 3 tabs, each tab started an activity and I realise when a tab is clicked onResume is call. If I have onCreate, when app start it will launch onCreate and then onResume immediately.So, I can just get ride of onCreate in this case?
View 2 Replies
View Related
Apr 6, 2010
I created a TextView and put an url to it, using setText(Html.fromHtml("");. Its opening the web page in the built-in browser and when I press back, its coming back to the application.
I don't want to come back to the application, so in activity's onResume(), I call finish(). Its exiting at the first time. But when I open the application again, its throwing some exception.
Any other way to close the application, other than this way.
View 2 Replies
View Related
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
Jan 18, 2010
I make 'hello world' app :-) and wrote a Log code in onCreate. and then give "android.intent.category.DEFAULT" and "android.intent.category.HOME"
This situation appears emulator(1.5, 2.0, 2.1). but HTC hero(1.5, original htc rom) didn't! it just call one time! Which is normal? and If calling twice is normal, why are they call twice?
View 2 Replies
View Related
Jun 15, 2010
I would like to know as to what will happen to the thread which has been created by an activity and the device is rotated. I have observed that the onDestroy method is called when this happens. Will the thread be killed too?If the thread is not killed, how can I reassociate the thread with the activity as a new instance of the activity is created on rotation.
View 1 Replies
View Related
Oct 4, 2010
Do those numbers seem normal to the rest of you? Right now if I am using my phone for browsing, video, etc. it will run the battery from full charge to dead in just under 4 hours. If I just leave the phone turned on but with no apps running (standby) it runs out of power in roughly 48 hours. Is this the battery life I should expect from this phone?
View 6 Replies
View Related
Oct 12, 2010
I have a ListPreference with the entries and entryValues correctly set. When I go in the prefernces activity and change the value it successfully works (I added a Toast to output the value after changing the option to test). But when I do the following to compare it, it always executes the else statment when I change it everytime, even like above when I changed the ListPreference and the value was "bluesky" it still failed to execute the correct if statement. Here's the code I use to check the value of the ListPreference in the onResume():
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this)
String backgroundPref = prefs.getString("backgroundPref", "");
if(backgroundPref == "bluesky"){
mainLayout.setBackgroundResource(R.drawable.bluesky);
Toast.makeText(getBaseContext(), "Blue Sky", Toast.LENGTH_SHORT).show();
}else if(backgroundPref == "sky"){
mainLayout.setBackgroundResource(R.drawable.sky);
Toast.makeText(getBaseContext(), "Sky", Toast.LENGTH_SHORT).show();
}else{
mainLayout.setBackgroundResource(R.drawable.sunsetscene);
Toast.makeText(getBaseContext(), "Sunset Scene", Toast.LENGTH_SHORT).show();
}
The Toasts are there so I can double check which statement gets executed, and it always seems to be the else one. Am I having a bad day and getting something wrong?
View 1 Replies
View Related
Sep 8, 2010
I've been using code like: activity.finish(); activity.startActivity(new Intent(activity, activity.getClass()));
in two places: onResume(), and in an onClick() method of an AlertDialog. I'm getting the desired results when the code is called from onClick(), but I get mysterious null pointer exceptions while the runtime is trying to execute my onPause(). Is calling finish() from within one of the Activity lifecycle callbacks always a bad idea?
This code makes me nervous even though it works in the onClick(). After I call activity.finish(), I would think activity is in a questionable state by the time activity.startActivity() is invoked. Seems like an invitation to race conditions.
My use case is setting UI preferences (e.g. a different layout) in a PreferenceActivity. When I return to the main activity's onResume(), I check for preference changes and if a new layout is requested, I use the code snippet above.
View 10 Replies
View Related
Jan 27, 2009
There's already been some discussion of this, in various lists and blogs. I finally got an AnimationDrawable to work, but I cannot start it from onResume. I can start it from a timer that onResume starts, or an onClickHandler.
I've poked around the source a bit and I can't figure out, specifically, what state the view has to be in, in order for the background AnimationDrawable to start.
Can anyone enlighten me?
View 5 Replies
View Related
Jan 14, 2010
Is there something like an application global onPause() and onResume()?
My main activity listens for GPS fixes, which I want to continue working when switching to another screen/activity. Therefor I cannot unregister my LocationListener in the activity's onPause(). However I still want to unregister my GPS listener when switching to another application (so save battery) and turning it back on when returning to my application, regardless what screen/activity the user is currently in. Any ideas?
View 1 Replies
View Related
Oct 16, 2010
I have two activities. One loads all rows from a database, and the other saves to the database. When I have the second save in onStop and the first repull the data in onResume, they do it out of order (the first resumes and then the second saves). I managed to fix this by putting the saving data in onPause, but why was this happening? Was this the cleanest way to do it?
View 1 Replies
View Related
Sep 18, 2009
I need to open a progress dialog on the onResume() method. But no dialog is opened. Any solutions for this?
View 3 Replies
View Related
Feb 20, 2010
I want to know what es the best place in an Activity to bind to a service? I saw examples doing it in onResume() and also in onCreate(). I was asking myself if it is not a problem putting it into onCreate(), cause in onPause() i will do a unbind to the service, so i dont get a serviceConnectionLeak, if i leave the activity. Now if i press the Home-Button and then switching to the HomeScreen, the Activity will unbind from the service, when i go back to the Activity from the Taskmanager, then onCreate() will not be called and if the Code is trying to access a function from the service i will get a null-pointer exception. If i bind and unbind only in onResume() and onPause() i dont have this problem.
View 3 Replies
View Related
Mar 14, 2010
I have a small test application I am working on which has a timer that updates a textview to countdown from 100 to 0. That works fine, but now I am trying to pause the application if the user presses the back button on the phone and then restart the timer from where they left off when they reopen the app.
From the Log.v() prints I see that the _timer_time_remaining variable has the correct number of seconds stored when onPause is called, but it is set back to 0 when onResume starts. Why does the variable get reset? I thought that the application would continue to run in the background with the same values. Am I missing something? This is all declared in a class that extends Activity.
View 2 Replies
View Related
May 8, 2010
I want to save text from 2 edittexts(et1,et2) and selection from 3 spinners(spinnerm,spinner and spinner2) onPause and setting them back onResume.
Text from edittexts is saved correctly, only spinner selection don't work as desired.
My code:....................
View 1 Replies
View Related
May 30, 2010
I'm having a hard time figuring out the best way to pass simple values from onPause and onResume in the Android activity lifecycle. I understand how to use get and put extra bundles for activity to activity data, but does that work for passing data between the same activity? Should i used SharedPreferences?
View 1 Replies
View Related
Oct 26, 2010
I am running into an issue with the way my asynctasks are executed. Here's the problem code:
firstTask = new background().new FirstTask(context);
if(firstTask.execute().get().toString().equals("1"))
secondTask = new background().new SecondTask(context);
What I'm doing here is creating a new asynctask object, assigning it to firstTask and then executing it. I then want to fire off a separate asynctask when the first one is done and making sure it returns a success value (1 in this case). This works perfectly on Android 2.0 and up. However, I am testing with Android 1.5 and problems start popping up. The code above will run the first asynctask but doInBackground() is never called despite onPreExecute() being called. If I am to execute the first task without the get() method, doInBackground() is called and everything works as expected. Except now I do not have a way to determine if the first task completed successfully so that I can tell the second task to execute. Is it safe to assume that this is a bug with asynctask on Android 1.5? Especially since the API says that the get method has been implemented since API 3. Is there any way to fix this? Or another way to determine that the first task has finished?
View 2 Replies
View Related
Sep 15, 2010
For example, I want to parse the string below:
Tue Sep 28 18:02:24 GMT+08:00 2010
And I use the pattern for the SimpleDateFormat:
new SimpleDateFormat("EEE MMM dd HH:mm:ss zzzzzzzzz yyyy");
But I keep getting the ParseException.
View 3 Replies
View Related
Aug 21, 2010
In the included LVL sample app, the license check is triggered during onCreate. This means that when I click "Buy App" to launch the market, then immediately hit the back button to return to the app, the dialog is gone and another check isn't performed, leaving me with a perfectly usable app (at least until the activity is killed and the process starts over again).Would triggering the license check during onResume() be bad form, even though it would fix this issue? Is there a better solution?
View 2 Replies
View Related
Oct 4, 2010
I just bought a second hand Samsung Galaxy Portal, and it's a great phone and works fine, but the battery is dead 12 hours after a full charge. I had a task killer installed at first but I removed it after reading about how it drains the battery, so I'm wondering what else it could be? I know it might just be an old battery that's lost it's will to hold charge, but what can I check on the phone before I have to splash out on a battery or take the phone back? I know it has some decent tools for monitoring battery usage so what should I be looking for?
View 4 Replies
View Related
Apr 21, 2010
Is there an app that gives the weather hourly for the next few hours? accuweather on my 5800 could do this but it doesn't seem to be able to on my desire.
View 5 Replies
View Related
Sep 12, 2010
When I am developing for Android and repeatedly running and/or debugging an Android app in the emulator then about every two hours or so I get an Out-of-memory exception, occasionally also an out-of - resources- or out-of-GWT-handles exception. At that point one can only stop and restart eclipse. Apparently the ADK must be doing something wrong, because I have been developing with Eclipse now for 5+ years and I normally never see this. ADT is a really the exception here. Is there any setting or patch that helps top avoid this? I have already given it more heap space (750M) to stretch the time between these hickups a bit, but that approach isn't really sustainable.
This is using Eclipse 3.5 (Galileo) and the Android SDK r06 running a FroYo AVD.
View 3 Replies
View Related
Apr 28, 2010
I am a new comer, previous owner of the iPhone 3G and the iPhone 3GS. I acquired an ADP1 through our research group at school since we were developing an application for Android (WifiMapper, helps you remember APs you've connected to by mapping them). Regardless, my iPhone 3GS from near battery death to full charge took maybe an hour and a half in USB, let alone a wall charger pushing a guaranteed hour and a half. However, I've found that my ADP1 takes at LEAST 6 hours to charge from around 5% charge. That seems like a long time to me... for instance, today it was at 12%, and I charged it for 3 and a half hours and it only went up to 52%.
View 9 Replies
View Related
Mar 10, 2010
In December, there were new terms for the Market. A big note was "You authorize Google to give the buyer a full refund of the Product price if the buyer requests the refund within 48 hours after purchase." It still seems that all references to the refund policy still state 24 hours. http://market.android.com/support/bin/answer.py?hl=en&answer=134336. So is it 48 or 24 hours officially? Is the 48 hours in the agreement just because the 24 hours never seemed to be a hard deadline. I noticed users refunding around 30 hours in the past.
View 3 Replies
View Related
Aug 24, 2010
My battery almost died after 6hrs unplugged, made 1 phone call, checked FB and email once. What happened? I have the incrediable, I had a full charge when I left at 7am, around 1 something my phone almost died. I had nothing running in the background
View 6 Replies
View Related
Jun 25, 2010
I am currently interested in learning more about developing android applications. I've made hello world for android but that is pretty much it.Has anyone read 'Sams Teach Yourself Android Application Development in 24 Hours'? If so would you recommend it? If not, could you point me towards some other resources?
View 2 Replies
View Related
Dec 10, 2009
Is there a way to have the clock show seconds, along with minutes & hours? If not, does anyone know of a third-party widget/app to do this?
View 1 Replies
View Related
Aug 16, 2010
I have HTC desire and find my battery life from fully charged to dead is between 4 hours to 6 hours.
Is anybody else having this problem or do you think the battery is faulty ?
I've only had the phone 4 months and find it annoying that i have to turn phone off to save battery. What's point having it as a phone if you have to turn it off..
View 4 Replies
View Related
Dec 9, 2009
Astrid is great! Easy to use. Small widget that displays tasks. Simple. Many options. but... When i reboot the Hero, it seems that the Astrid widget takes almost FOREVER! and i really do mean hours to load.
View 3 Replies
View Related