Take the 2-minute tour ×

I have a bit of a weird problem integrating a native game with a Java application in Android.

I have to add a native .so file for a game and wrap it with standard Activities to show a splash screen, a menu and some other stuff.

I notice within the native code there appears to be a kill process call. I see this in the logcat.


Followed by this

DEBUG/Zygote(119): Process 28720 terminated by signal (11)

This happens when I hit an exit option in the native game. When this happens the application gets restarted i.e. the Activity set as launcher in the manifest get's created in a new process. I see in logcat that the Activity manager notes the process has died and then does this:

INFO/ActivityManager(192): Start proc my.package.name for activity my.package.name/my.launcher.Activity: pid=28820 uid=10061 gids={3003, 1015}

Unfortunately I can't get the native source and can't get it changed.

The best solution I have come up with so far is to do some kind of check in the onCreate and call finish if I think the app has been restarted. I really don't like the idea of doing that though, which is why I am posting here now.

Does anybody have any suggestions on a "good" way to handle this? Any ripping apart my proposed solution is also welcome.

I guess it's not a standard problem so the framework probably does not have much to help me here. Despite my many hours of reading docs and developing on Android I am still far form being an Android expert so any advice at all on this would be a great help.


Just a note, this behavior is reproducible by creating 2 Activities. The first one should launch the second. The second Activity should have a way to kill the application process such as a button that calls


So if Activity A is the launcher Activity in the manifest. A starts B. B kills process. A gets started automatically by the Android OS in a different process.

I did this as a test to see if anything I was doing was causing the restart. The test is exactly as described with no edits to the manifest and no extra code. The restart will always happen. Just wish I could find a way to stop it from happening.

share|improve this question
Does this happen every time? Or only when started first time from the Android Market (Google Play) or Eclipse? –  Android Eve Aug 8 '12 at 12:38
It happens every time. Don't have the app on Google Play. I generally run the app from IntelliJ or I create a signed APK so I can send a download link around to people to test the app on different devices. –  Ruairi Aug 10 '12 at 9:28

1 Answer 1

Sorry. This should be a comment, but I dont have enough privileges yet. I mapped another situation when Android restarts apps, is when an unhandled exception is thrown from a background activity (paused in lifecicle).

For example, a TextView with an EventListener (TextChangedListener) on it, when the keyboard is active and the eventListener throws an exception, the app will crash and then will be restarted by Android. But I dont know yet how to prevent it.

share|improve this answer

Your Answer


