Chinaunix首页 | 论坛 | 博客
  • 博客访问: 407184
  • 博文数量: 120
  • 博客积分: 3125
  • 博客等级: 中校
  • 技术积分: 1100
  • 用 户 组: 普通用户
  • 注册时间: 2007-10-29 10:59
文章分类

全部博文(120)

文章存档

2012年(28)

2011年(22)

2010年(34)

2009年(1)

2008年(35)

我的朋友

分类: LINUX

2010-09-26 15:58:18

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

}


阅读(553) | 评论(1) | 转发(0) |
0

上一篇:AR6K backport

下一篇:获取手机里面的apk

给主人留下些什么吧!~~

chinaunix网友2010-09-27 10:44:14

很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com