如何在單擊按鈕上啟動新活動在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 關注
- 515 瀏覽
添加回答
舉報
0/150
提交
取消
