如何在单击按钮上启动新活动在Android应用程序中,当单击另一个活动中的按钮时,如何启动新活动(GUI),以及如何在这两个活动之间传递数据?
3 回答

海绵宝宝撒
TA贡献1809条经验 获得超8个赞
Intent i = new Intent(getBaseContext(), ViewPerson.class); i.putExtra("PersonID", personID);startActivity(i);
Bundle extras = getIntent().getExtras();if(extras !=null){ personID = extras.getString("PersonID");}
public class YourApplication extends Application { public SomeDataClass data = new SomeDataClass();}
YourApplication appState = ((YourApplication)this.getApplication());appState.data.CallSomeFunctionHere(); // Do whatever you need to with data here. Could be setter/getter or some other type of logic
- 3 回答
- 0 关注
- 493 浏览
添加回答
举报
0/150
提交
取消