Android --- Bundle实现数据的读取
生活随笔
收集整理的這篇文章主要介紹了
Android --- Bundle实现数据的读取
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
在activity間傳遞信息
Bundle bundle = new Bundle(); //得到bundle對象 bundle.putString("sff", "value值"); //key-"sff",通過key得到value-"value值"(String型) bundle.putInt("iff", 175); //key-"iff",value-175 intent.putExtras(bundle); //通過intent將bundle傳到另個Activity startActivity(intent);讀取數據
Bundle bundle = this.getIntent().getExtras(); //讀取intent的數據給bundle對象 String str1 = bundle.getString("sff"); //通過key得到value int int1 = bundle.getInt("iff");總結
以上是生活随笔為你收集整理的Android --- Bundle实现数据的读取的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Android --- 自定义Image
- 下一篇: Java 洛谷 P1014 Cantor