位置:首页> 开发 > 数据存储 > 浏览文章

Android中使用Bundle进行数据传递和存储[页14]

2023-08-23
javaBundle bundle = getIntent().getExtras();
String name = bundle.getString("name");
  1. 传递整数数据
javaIntent intent = new Intent(MainActivity.this, SecondActivity.class);
Bundle bundle = new Bundle();
bundle.putInt("age", 25);
intent.putExtras(bundle);
startActivity(intent);

在目标Activity中获取数据:

首页 上一页 11 12 13 1415 16 17 下一页 尾页
下一篇:

相关阅读

热门推荐