android-studio - android数据Activity传值的问题

查看:162
本文介绍了android-studio - android数据Activity传值的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

初学,这段代码也是在网上找的

Intent intentSimple = new Intent();
intentSimple.setClass(Layout_1.this,Layout_2.class);

Bundle bundleSimple = new Bundle();
bundleSimple.putString("username", username);
bundleSimple.putString("password",password);
intentSimple.putExtras(bundleSimple);
startActivity(intentSimple);

请问为什么出现错误?

解决方案

你贴的代码没问题,检查一下接受值时有没有问题,问题应该是在Layout_2.class里

这篇关于android-studio - android数据Activity传值的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆