I have a Main Activity in my app for Navigation Drawer. A Fragment starts from this activity has a listview which contains some data. Further clicking on that lisview Items take me to another activity which contains a clickable link, clicking on this link takes me to the browser. This flow is working very well on devices that have RAM greater than 1GB, but it crashes the app after the back button is pressed in Devices that have RAM equal or Less than 1GB. The thing which make me wonder is, ON BACK PRESS IT GIVES ME THE MAIN ACTIVITY CONTEXT NULL
on that devices. Can somebody tell me what is the issue that I am having. I have tried many code variations and following the exact life cycle for Activities and Fragments that developers site suggests.
Asked
Active
Viewed 397 times
0

Abid Khan
- 2,451
- 4
- 22
- 45
-
You need to handle instance saving of your application. See http://stackoverflow.com/questions/151777/saving-activity-state-in-android – Eugene Popovich Oct 09 '14 at 07:38
-
Can you post the stack trace? – Sripathi Oct 09 '14 at 07:54
1 Answers
1
For devices with less RAM, Android kills your application to save memory when your application goes to background. Hence try to save the application instance using savedInstanceState and
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onRestoreInstanceState(savedInstanceState);
}
to restore your previous state.

Vishal Ramachandran
- 175
- 4