TextView中始终显示值" 0 QUOT;在UI [英] TextView always showing value as "0" on UI
本文介绍了TextView中始终显示值" 0 QUOT;在UI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用的是简单的TextView和更新其在的AsyncTask的onPostExecute价值。但每一次它表现为0的UI。
I am using a simple TextView and updating its value in onPostExecute of a AsyncTask. But every time its showing "0" on UI.
我的code是:
TextView tv = (TextView)findViewById(R.id.tv);
tv.setText(calculation());
private int calculation(){
return output;
}
这是怎么回事错在这里,没有错误的堆栈跟踪正在添加?请大家帮我?
What is going wrong here, no error comming in stack trace? please help me?
推荐答案
您code tv.setText(计算());
tryind把字符串从资源的开发因为你设置的值为int。
Your code tv.setText(calculation());
tryind to take string from Resourses cause you set value as int.
使用 tv.setText(将String.valueOf(计算()));
这篇关于TextView中始终显示值" 0 QUOT;在UI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文