In between onPause and onResume

Put your problem here if it does not fit any of the other categories.

In between onPause and onResume

Postby onompoly » Tue Jun 29, 2010 3:11 am

I want to run some code when the activity is specifically resumed and only resumed from being paused and running onPause, NOT additionally after onStart, which runs after onCreate.

There must be some way, if there isn't.. will some one enlighten me as to the purpose of placing code in onResume, considering its ran even when the activity is doing no resuming???
onompoly
Freshman
Freshman
 
Posts: 9
Joined: Fri May 21, 2010 5:04 am

Top

Re: In between onPause and onResume

Postby anarche » Tue Jun 29, 2010 5:35 am

onPause() is called every time the Activity is created; the first time (after onCreate()) and subsequent times.

You place code in here to run in an alternative thread to speed up the loading of the gui thread. Alternatively you place code here that is counted in onStop() (such as cursor creation etc) to save memory leaks and similar errors.

I think you may need a isPaused flag in your Activity to achieve this. Make sure to set it to false/default in onStop, since you have no guarentee that onDestroy is called...
anarche
Master Developer
Master Developer
 
Posts: 369
Joined: Sun Apr 11, 2010 5:21 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 34 guests