O
O
OlegTar2015-07-25 01:05:18
Android
OlegTar, 2015-07-25 01:05:18

Android: how to call a method after returning from another activity via home button?

The situation is this.
There is an android application with an ActionBar
. From the main activity, we call another activity using the standard code.

Intent intent = new Intent(this, <class>.class);
startActivity(intent);

You can return from another activity either with the Back button or through the Home button on the ActionBar.
You need to call the class method of the main activity, after returning to it through the Home button on the ActionBar.
As a last resort, you can simply make the Home button work like the Back button, because in both cases you need to call the same method.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Emin, 2015-07-25
@OlegTar

startActivityForResult()

K
Konstantin Dovnar, 2015-07-25
@SolidlSnake

I love it when people ask and answer themselves. Thank you.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question