文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Share data between Activities

Share data between Activities

时间:2010-09-26  来源:xiaosuzi

1.Using Bundle to transfer the data between activities
public class myClass extends Activity
{

Intent myIntent = new Intent();

myIntent.setClass(myclase.this,other.class);

Bundle myBundle = newBundle ();
myBundle.putDouble("height",height);
myBundle.putString("sex",sex);

myIntent.putExtras(myBundle);
startActivity(myIntent);
myClass.this.finish;

}

 

2.get the data from the passing activity
public class otherClass extends Activity

{

Bundle myBundle = this.getIntent.getExtras();
String sex = myBundle.getString("sex");
Double height = myBundle.getDouble("height");

TextView tv = (TextView)findViewByid(R.id.text1);
if (sex.equals("M"))
    tv.setText("Male");
else
    tv.setText("Female");

}


相关阅读 更多 +
排行榜 更多 +
mirrox模组(玩家自制)手机版下载

mirrox模组(玩家自制)手机版下载

休闲益智 下载
集装箱模拟器手机版下载安装

集装箱模拟器手机版下载安装

模拟经营 下载
哔咔漫画app下载免费2025

哔咔漫画app下载免费2025

浏览阅读 下载