天天看点

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");      

继续阅读