TextView.setText方法是重载的,既可传入 String类型的参数也可传入int类型的参数 。 这就使得 , 当妳要将 一个R.string.something与别的字符串连接起来之后 再传入 TextView.setText方法时,参数 会被当成整数处理,于是,显示出来的是一长串数字。解决办法 是将R.string.something使用getString方法包裹起来 。
http://www.eoeandroid.com/thread-53042-1-1.html
亮点 :
R.string.result是一个INT型的资源ID, 所以R.string.result+result还是一个INT型,而这INT型ID的资源是不存在的,textView.setText()可以是 textView.setText(string str)和textView.setText(int id),当ID资源不存在时,ID会toString()转换为字符串,故相当于调用了textView.setText(string str);
你应该这样:textView.setText(this.getString(R.string.result) + result);
袁洁莹
HxLauncher: Launch Android applications by voice commands