android Bundle学习(2016年01月07日12:58:36):

来源:互联网 发布:手机淘宝如何评价 编辑:程序博客网 时间:2024/05/22 08:10

Bundle 中文翻译为“捆”,意思是把某个变量一并捆起来作为一个对象。

发送端:

Intent intent=new Intent(MainActivity.this,Bundle2.class);                Bundle bundle=new Bundle();                bundle.putString("Data","this is bundle");                bundle.putString("Data2","anniu");                intent.putExtras(bundle);                startActivity(intent);

接收端:

Bundle bundle=getIntent().getExtras();        String s=bundle.getString("Data");        String s1=bundle.getString("Data2");
0 0
原创粉丝点击