2

I have main activity that have grid of images and details activity which display one image. When you click on image of main activity the app launch the detail activity with the selected image. I want to return from details activity to the main activity without calling on create of the main activity because it consumes a lot of time. How can I do that ?

I use

 Intent in = new Intent(Search_costumer.this,Customer_details.class);
    startActivity(in);

to navigate from the main activity to the details activity

3 Answers3

1

Use Bundle savedInstanceState because its maintain state of your activity like Bluetooth once its ON after switch off your phone its still On.Somewhere Its maintain its status(On/OFF).

Ashish Mishra
  • 167
  • 2
  • 10
0

when you are switching to details activity donot finish your main activity and when you return from there onResume will get called and not onCreate

sheetal
  • 3,014
  • 2
  • 31
  • 45
-1

When you start your DetailsActivty, Do not call finish() from MainActivity. This will not destroy your MainActvity and when you click back button from DetailsActivity, onResume() will be called for MainActivity. You can take help of this Link.

Hope this help, if any confusion feel free to ask

Community
  • 1
  • 1
Android
  • 3,828
  • 9
  • 46
  • 79