android开发——显式intent

时间:2014-03-12 08:51:59   收藏:0   阅读:464

   之前的android学习都是只有一个页面的android应用,而在实际应用中,一般都含有多个页面,所以有必要学习android是如何在多个页面之间进行转换的。在android中,是通过intent实现多个页面的跳转的。intent又分为隐式和显式的。显式的intent就是在明确知道当前页面和下一个页面,并且下一个页面是本工程的activity时。隐式的现在还没弄明白,明天将继续学习,先把显式调用的代码贴上。


MainActivity跳转到OtherActivity,并传递数据

//实现MainActivity到OtherActivity的跳转
Intent intent = new Intent(MainActivity.this,OtherActivity.class);
intent.putExtra("who", "xiongmao");
MainActivity.this.startActivity(intent);

 


OtherActivity接受数据

info = super.getIntent().getStringExtra("who");
button = (Button) findViewById(R.id.bt_bnext);
button.setOnClickListener(this);


android开发——显式intent,布布扣,bubuko.com

原文:http://buaaxiongmao.blog.51cto.com/6169897/1373529

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!