我是刚刚开始学习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);
运行通过了,请问这是为什么呢?
解决方案 »
- javaweb 与android 通信
- android开发环境如何搭建和配置?
- 如何在桌面上建立模拟器的快捷方式
- 如何实现手机应用使用情况的统计功能
- 如何将edittext里的文本存入SD卡上??
- android静态壁纸概率性设置失败
- Android WebView falsh 全屏播放白屏
- android4.4修改SystemUI编译出错
- sdk manager 无法更新
- 13:16 Emulator: Warning: Quick Boot / Snapshots not supported on this machine. A
- android如何读取文件啊
- C++怎样运用于Android平台下
只是year.getText().toString()不能为空,或者不是数字
否则就会抛出异常..