码上敲享录 > android开发实例 > android页面跳转实现

android页面跳转实现

上一章章节目录下一章 2018-04-06已有4434人阅读 评论(0)

android页面跳转实现

解决方法:

1、MainActivity的代码:

//将数据存到Bundle

Bundle bundle = new Bundle();

bundle.putBoolean("sex", true);

bundle.putInt("height", 165);

//实例化Intent,MainActivity指当前的Activiti名字,ResultActivity是要跳到的Activitiy,就是说from MainActivity to ResultActivity跳转的过程。

Intent intent = new Intent(MainActivity.this,ResultActivity.class);

intent.putExtras(bundle);//把数据通过Intent传到下一个Activitiy显示

startActivity(intent);


2、ResultActivity的代码:

//得到Intent

Intent intent = getIntent();

//取出Bundle

Bundle bundle = intent.getExtras();

//得到性别和身高

boolean sex = bundle.getBoolean("sex",false);

int height = bundle.getInt("height",170);


本文地址:http://www.yayihouse.com/yayishuwu/chapter/1154


向大家推荐《Activiti工作流实战教程》:https://xiaozhuanlan.com/activiti
7

有建议,请留言!

  • *您的姓名:

  • *所在城市:

  • *您的联系电话:

    *您的QQ:

  • 咨询问题:

  • 提 交