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

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

2023-08-23
javaBundle bundle = getIntent().getExtras();
int age = bundle.getInt("age");
  1. 传递布尔值数据
javaIntent intent = new Intent(MainActivity.this, SecondActivity.class);
Bundle bundle = new Bundle();
bundle.putBoolean("isStudent", true);
intent.putExtras(bundle);
startActivity(intent);

在目标Activity中获取数据:

首页 上一页 12 13 14 1516 17 18 下一页 尾页
下一篇:

相关阅读

热门推荐