0

I dont want to close my application when uses press home button. But on some devices, android system closes my application. This is scenario:

  • SCENARIO X: (I WANT): Activity A->Activity B-> Activity C - PRESS HOME BUTTON- Launch application - User see Activity C
  • SCENARIO Y : Activity A->Activity B-> Activity C - PRESS HOME BUTTON- Launch application - User see Activity A

Here is the problem: My app uses over 80mb memory. Some devices dont close app on home press (LG G2), some devices closes application on home press. (Samsung Note 2) Is it may be because of high memory usage?

P.S: I tried all Launchmode parameters.

ngrashia
  • 9,869
  • 5
  • 43
  • 58
sipdorus
  • 963
  • 1
  • 12
  • 28

2 Answers2

1

Yes, the most probable reason should be the memory usage. Android OS handles memory usage by its own. When other priority apps need memory, it will close other less priority apps and thus will make the memory available.

To know more about managing your app's memory usage, see this https://developer.android.com/training/articles/memory.html

Hirak Chhatbar
  • 3,159
  • 1
  • 27
  • 36
0

You can use frame layouts in your activity.Instead of launching a new activity,just replace the frame layout.You will have only single activity with muliple Frames.You can control the display of frames how ever you want.

You can destroy your frame or you can cache it in LRU cache when the Frame is no longer needed to save memory.

Meher
  • 2,545
  • 3
  • 26
  • 53