How about having other activities in a shared library, from other 
developers?

I have a native thread and I have to work with the assets directly from the 
native code (it is really a port of a complete game). Loading the whole 
archive is pretty slow and I have to reload it each time I pause/resume - 
but let me explain the situation in more details.

Let me list the issues I had encountered before, perhaps my solutions were 
far from ideal:

1. I figured out that the asset file is *lost* for the native code after a 
*real* pause/resume - both if I get the FD from java-code or fopen the file 
in C-code. So I have to close it on pause and reload on resume. It's 
annoying to wait for that reload in a situation when you don't really 
switch to another app, but just have another activity on top.  I suspect 
that pausing just the activity won't cause any trouble like that (droppping 
the file).

2. Also I sometimes had a problem of the touch device being not able to 
detect touches - after several pause/resumes. As I got it, the issue was 
connected to the fact that the files were released only after resume and 
not on pause.


Also, sometimes it seems you don't really get the app suspended even 
switching to another app, like when you adjust sound volume - will be cool 
to know when onPause is caused by a similar event - to try if it really 
causes the issues with the assets. As I remember it didn't crash in 
situations like that - it did only after a "real" app suspending. 




пятница, 3 июня 2011 г., 12:55:44 UTC+4 пользователь Zsolt Vasvari написал:
>
> Set a flag "iAmStartingMyNextActivity=true" before you call 
> startActivity and in onPause() check for the flag. 
>
> If you create a base MyAppActivity which extends Activity and you 
> extend all your activities from MyAppActivity, you should be able to 
> do this without puttting any code into every one of your activities. 
>
>
>
> On Jun 3, 4:24 pm, Dalvin <[email protected]> wrote: 
> > Hi 
> > 
> > My question is can i get to know when the entire application gets 
> > paused/resumed start/stop etc. 
> > For example if i have 5 activities in my application. Whenever any 
> activity 
> > gets paused/resumed android notify the activity by calling the 
> > onPause/onResume methods. 
> > 
> > So there are two possible scenarios when my activity gets paused. 
> > 1. My activity-2 gets paused because my activity-3 gets invoked. 
> > 2. My activity-2 gets paused because of some outside activity like 
> incoming 
> > call. 
> > 
> > Here I am interested only tracking when my activity gets paused by 
> outside 
> > activities not my own application activities. 
> > 
> > So is there any android provided solution for this or do I have to write 
> my 
> > customized solution. 
> > 
> > Thanks 
> > Dalvin

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

Reply via email to