Android tab activity strange behaviour - android

I have a tabactivity, from it when I start another activity then this activity is getting destroyed.
Now this happens on one device whereas on other its working fine.
If due to bad luck there comes no soln for this, then is there any workaround ?
I am detecting the home activity destroy as an exit from app.

Well it was a rare issue, the device was having too many google account and apps, when reset its working ok. It was a memory issue i think.

Related

Simulate backstack savedInstanceState behaviour

I want to test the state of my app when it's left in the backstack for too long.
When I open like 20 apps one after the other my last used app (which is the app I'm testing) eventually terminates and a savedInstanceState occurs. Is there a way to simulate this behaviour for the app I'm testing without having to open another 20 apps in order to burry my app in backstack?
Yes, there's a simple way to do it. Just enable Do not keep activities under Developer options. Your activity will then be immediately destroyed as soon you leave it and onRestoreInstanceState() will be invoked when you return.
Alternatively, you can force a configuration change (like orientation) and that will recreate your activity too. One issue with this approach is that there's a bug with some JellyBean/KitKat versions where the emulators fail to rotate. (This works fine on a device though.)
The workaround is to install the RotateScreenOrientation.apk which can force the emulator to be in portrait or landscape but this quickly becomes tedious if you have the option to Wipe user data on emulator start enabled.

Return to second activity after clicking home button

I've tried all launchMode's yet it does not seem to work:
Suppose App A has various activities, J & K. J is the initial one (to choose app mode), which calls K where the main things happen (after calling it, J finish()es). If i click "Home" button in K, and then open the app again, it opens a new instance of A with activity J.
I'd like it to open the paused K activity instead. Other threads mention an Android bug -- is there a way to fix it? Setting launchMode does not work :S
Thanks a lot.
What you want is normal Android behaviour. The fact that it isn't working means that you are probably doing something strange. Do not try to solve this by playing around with launchModes. Please post the relevant parts of your manifest. There is, however, a bug which manifests itself like this. To see if this bug is causing your problem do the following: force-close your app on the phone. Now start your app from the list of apps on the phone. Go from ActivityJ to ActivityK. Press HOME. Open the app again. If it works now, you are just seeing the dreaded Android launch bug.
For more details on the launch bug, see these issues:
http://code.google.com/p/android/issues/detail?id=2373
http://code.google.com/p/android/issues/detail?id=26658
The bug is there on all devices, on all versions of Android (at least up to ICS, haven't tested on JellyBean yet). It all works as it should in the emulator, so you cannot use emulator behaviour as an indication of real device behaviour.

Phonegap persistent app in background, how to?

i have a Phonegap and JQM app.
Problem is, if I switch to another app and then back to my app, App is completely reloaded and start again.
Is posible this disable?
Thanks for any advice.
This is happening because there is a lack of memory for the app to run. So as soon as u go to home the app dies and on opening again it reloads the app from the start. To confirm that this is indeed happening i would suggest that you close all running apps on your phone and then run your app. Im sure it would run properly even after switching to home screen and coming back.I don't think its possible to get around this behavior. Design your app so that it has a small startup time so that its usable even on phones with less ram where such problems would come.

Re-opening activity kills process

In my app when i press home button and open the app from menu or shortcut it returns in the same screen but the pid of the process is killed.
BUT
if i hold home button and choose my app from there it will resume normally
This problem is not happenig in all devices 2.2.1 and 2.3.5 samsung galaxy Ace
if is solved again ( i doubt i lost many hours searcing) please link the answer
Thanks in advance
EDIT
In 2.3.6 Samsung Nexus S doesn't happen.
You shouldn't worry about that. The whole Android ecosystem is built around the concept of never terminating your application yourself, and letting the OS handle that aspect of things, and it's working very well if your app is written following the good practices.
Make good use of the Activities lifecycle methods (onPause, onResume, onStop, etc.), and everything will work smoothly, whether your app has been effectively terminated or kept in the background by Android.

Is there a way to update the AVD after making changes without restarting it?

Like the title says, whenever I make any changes in the code I don't see the changes in the AVD. Is there a way to do this without closing the AVD and starting it again?
I'm using Eclipse.
Thanks!
I have noticed this behavior at times as well. In the ADB log it will state something like the activity is already started and has been brought to the front even though it was already on the screen. Not sure what the cause of this behavior is and it seems to happen randomly. I have dealt with this in the past by force stopping the app in the AVD or just uninstalling it. Sometimes pressing the home button on the AVD and then running the APP from eclipse seems to fix this.

Categories

Resources