Activity之間簡單數據傳遞

利用安卓自帶Bundle或者Intent對象封裝數據即可,代碼如下:

Intent i=new Intent(MainActivity.this,Second.class);
Bundle bundle=new Bundle();
bundle.putString("name","里斯");
bundle.putInteger("age",25);
i.putExtra("uerData",bundle);
startActivity(i);
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章