[英]after returning back from my second Activity to first Activity on clicking button the whole data is gone
I have two activties: activity_main, activity_display我有两个活动:activity_main,activity_display
in the main_activity user enters his/her name and presses the toggle button to display.在 main_activity 用户输入他/她的名字并按下切换按钮来显示。 that takes the user to display_activity page where the result is displayed.
将用户带到显示结果的 display_activity 页面。 if the user finds that he/she has entered the wrong info they can go back and edit.
如果用户发现他/她输入了错误的信息,他们可以 go 返回并编辑。
here is where the problem starts after pressing the toggle button - display it goes to display_activity and displays but when I press "back" button I'm restarting the whole (first) main_activity again... no values are present... even the toggle button that needs to be set to "reset" is again showing "display".这是按下切换按钮后问题开始的地方 - 显示它转到 display_activity 并显示,但是当我按下“返回”按钮时,我再次重新启动整个(第一个)main_activity......没有值存在......即使是需要设置为“重置”的切换按钮再次显示“显示”。
should i use something else instead of我应该用别的东西代替
startActivity(intend1);
i want to resume the (first) activity main not restart everything我想恢复(第一个)活动主要不重新启动一切
Seems like your first activity uses results from second activity.似乎您的第一个活动使用了第二个活动的结果。 you can use startActivityForResult.
您可以使用 startActivityForResult。 Here is a very good answer refer to it.
这是一个非常好的答案,请参考它。
How to manage startActivityForResult on Android 如何在 Android 上管理 startActivityForResult
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.