2

When open my application first time , i pressed home key.

again i click my application.

its not calling onResume() directly. its loading from splash screen onCreate().

is it android default.?

After i've pressed "Back" button , app has closed . there after ,i opened the application and pressed home key, the issue dont come its calling onResume() method not from splash screen onCreate().

My problem is , before pressing back key, if we press home key and open the app, tha app will opened newly. its added in stack.

I've download "Facebook" application and checked. that app also hav same issue.

How do resolve this problem in android?

RVG
  • 3,538
  • 4
  • 37
  • 64

5 Answers5

2

Android may decide to kill your application when it's not in the foreground. If the application was killed, starting it again would probably show the splash screen again.

zmbq
  • 38,013
  • 14
  • 101
  • 171
1
When open my application first time , i pressed home key.
again i click my application.

When you press Home Key then your application will go in background, and it will start from where you left if you directly open your application from background apps list. (Button beside HOME key)

And if you click on application icon from list of apps, it will launch again from first activity.

You can refer to this link

How to make an android app return to the last open activity when relaunched?

Community
  • 1
  • 1
Nirali
  • 13,571
  • 6
  • 40
  • 53
  • false. It only starts the android.intent.action.MAIN if it was killed (manually or by the system). If you use the home button and then restart it it will recognize the activity stack and return to the last activity. It does not matter if you start it from the app list. – cwin Jun 07 '13 at 13:02
1

Check your Developer options. My guess is that your problem is "Don't keep activities".

cwin
  • 956
  • 1
  • 7
  • 14
1

i got solution from here: http://code.google.com/p/android/issues/detail?id=2373

add this code onCreate() method in splash screen activity:

if (!isTaskRoot()) {
    final Intent intent = getIntent();
    final String intentAction = intent.getAction();
    if (intent.hasCategory(Intent.CATEGORY_LAUNCHER) &&
            intentAction != null && intentAction.equals(Intent.ACTION_MAIN)) {
        finish();
    }
}
RVG
  • 3,538
  • 4
  • 37
  • 64
0

I think your app will be killed if you need too much memory in the background. So if you know that your app goes to the background free some memory. It must not be all but for testing you could try it.

There is also a callback which informs you that you should free your memory:

@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
@Override
public void onTrimMemory(int level) {
    super.onTrimMemory(level);
    if(level >= TRIM_MEMORY_MODERATE) {
        // free some memory
    } else if(level >= TRIM_MEMORY_BACKGROUND) {
        // free some more memory
    }
}
rekire
  • 47,260
  • 30
  • 167
  • 264