How to transfer data back to parent activity

In my application, I see several actions ...

Main | -------------------- Login | | | --------------- Dashboard | ----------------------------------------- | | | Activity1 Activity2 Activity3 

If the user is logged in, he bypasses the login and goes directly to the dashboard. Then I see a toolbar that launches other actions. Currently, my main vision is as follows:

 public class MainActivity extends Activity { User user = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); startActivity(new Intent(this, LoginActivity.class)); } } 

I tried to find a code example showing how to transfer data from my login activity to Main, but I struggled. I can find many examples of how to transfer data from parent activity to child activity, but not vice versa.

PS - If I am not on the right track with my application, please let me know!

+4
source share
1 answer

Have you looked at startActivityForResult?

See this tutorial: http://www.mybringback.com/tutorial-series/12186/android-startactivityforresult-example/

+5
source

All Articles