您的位置:首页 > 移动开发 > Android开发

Cannot resolve method 'putExtra(android.os.Bundle)' Intent界面跳转传值

2016-04-29 11:57 691 查看
今天在做界面的跳转的时候 .putExtra(mBundle) 一直报错,提示错误是:
 Cannot resolve method 'putExtra(android.os.Bundle)'

这是跳转部分代码:
switch (v.getId()){
case R.id.search_not_baidu:
Bundle mBundle = new Bundle();
mBundle.putString("webUrl","http://www.baidu.com");
startActivity(new Intent(context, JumpWepPageActivity.class).putExtra(mBundle));
context.finish();
break;
case R.id.search_not_360:
context.finish();
break;
}

按说不应该啊  我跳转一直这么写怎么会出错呢  一直没找到原因!
后来我从之前的逻辑差不多的一段跳转代码里 复制了过来, 覆盖掉这段代码然后就没事了 ! 郁闷…… 都一样啊
这是我从从之前的代码里找的逻辑差不多的代码:
hot_listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Bundle mBundle = new Bundle();
mBundle.putInt("Id",Integer.valueOf(specialInfoCommonAdapter.getItem(position).getId()));
startActivity(new Intent(context, SpecialBrandDetailsActivity.class).putExtras(mBundle));
}
});

是不是一样的 跳转逻辑!  开始以为是不是包导错了 结果检查了发现 根本不是…… 希望有朋友遇到同样问题解决了的 可以和我说一下
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Intent