Mobile Technologies Mobile Computing . 1 year ago

Android: Change Screens [duplicate]

Android: Change Screens [duplicate]

2 views   1   0 likes   0 shares Tuteehub forum manpreet 1 answers
_x000D_ _x000D_ Possible Duplicate: How do I pass data between activities in Android? My App starts and loads the first screen, then the users changes to the next screen by clicking a button with: Intent intent = new Intent(DashboardActivity.this, LoginActivity.class); startActivity(intent); and then from there, the user changes to the next screen, again with: Intent intent = new Intent(LoginActivity.this, NextActivity.class); startActivity(intent); now there should be 3 screens on the stack and in this last screen, I want to go all the way back to the first screen, how do I do that with one click? I want to send putExtra("") data from that last screen to the first screen.
tuteehub_quiz
Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

profilepic.png

Tuteehub forum answer Answers (1)


profilepic.png
manpreet Tuteehub forum best answer Best Answer 1 year ago
_x000D_ Add this In NextActivity, Intent myIntent = new Intent(NextActivity.this, DashBoardActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); myIntent.putExtra("UserName",UserName); startActivity(myIntent); In DashBoardActivity, Intent intent = getIntent(); UserName=intent.getStringExtra("UserName");
2 views   0 shares
Related Tags

AskAnything Ask Anything

Ask Me Anything

ask me anything tuteehub

Hello! How can I assist you today?
Whether you have questions, need information, or just want to chat, feel free to let me know