天天看點

Android開發值利用Intent進行put傳值,setclass啟動activity,并用get進行取值

傳值方法一
[java]  
Intent intent = new Intent();  
Bundle bundle = new Bundle(); //該類用作攜帶資料  
bundle.putString("name", "tom");   
bundle.putString("ip","8.8.8.8");  
intent.putExtras(bundle); //為Intent追加額外的資料  
 
傳值方法二
[java]  
Intent intent = new Intent();  
intent.putExtra("name", "tom");   
intent.putExtra("money", 1098978009L);  
 
擷取值
[java]  
Bundle bundle=getIntent().getExtras();  
String name=bundle.getString("name");      

繼續閱讀