Android学习中遇到的坑

来源:互联网 发布:网络进度计划波浪线 编辑:程序博客网 时间:2024/06/03 08:39

遇到的常量,比如需要在intent中的extra用到的,如果单独写的话,很容易遇到错误,比如intent.putExtra("country_code",countryCode);
但是我取值的时候,写成getIntent。getStringExtra("countryCode"),这个时候,也不会报错,但是就不能得到正确的结果,这个地方一定要注意,其实可以把country_code定义成 private final static String COUNTRY_CODE,这样就可以了。

0 0