我是刚刚开始学习android开发,其中遇到这样一个问题:
int year_int = Integer.parseInt(year.getText().toString());
当这样写这行代码的时候,运行不通过,报错说是Integer的问题,于是我便这样写:
String tem1 = year.getText().toString();
int year_int = Integer.parseInt(tem1);
运行通过了,请问这是为什么呢?
int year_int = Integer.parseInt(year.getText().toString());
当这样写这行代码的时候,运行不通过,报错说是Integer的问题,于是我便这样写:
String tem1 = year.getText().toString();
int year_int = Integer.parseInt(tem1);
运行通过了,请问这是为什么呢?
解决方案 »
- ExpandableListView SimpleExpandableListAdapter 添加数据报错
- android手机做服务器端,pc做客户端,通过USB基于socket连接,怎么从手机sdcard的相册目录把所有图片全部保存到pc客户端
- 请问安卓系统上开发的软件如何与PC连接
- android页面布局 如何让中间的listView填充剩余部分
- Android菜鸟求教~
- android 如何自动打开GPS
- android fragment点击返回键实现内容切换?
- android报错,新手,求指导
- PtrFrameLayout 嵌套横向滑动RecyclerView,横向滑动冲突问题
- 小米日历提醒接入问题
- android如何读取文件啊
- C++怎样运用于Android平台下
只是year.getText().toString()不能为空,或者不是数字
否则就会抛出异常..