显示方法的参数在一个TextView或吐司 [英] Displaying parameters of method in a textview or toast
本文介绍了显示方法的参数在一个TextView或吐司的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嘿家伙,我无法弄清楚背后为什么我的code不工作的逻辑,显然不准我用这种方式打印出这些值。我无法显示V1,V2,V3或V4的值转换为烤面包或一个文本框,但我可以显示的字符串。我在调用这些价值观错了吗?
如果你需要我发布更多code让我知道。
testWheelValue(R.id.passw_1,V1);
testWheelValue(R.id.passw_2,V2);
testWheelValue(R.id.passw_3,V3);
testWheelValue(R.id.passw_4,V4);
testpins = V1 + V2 + V3 + V4;
text.setText(testpins);
// Toast.makeText(getBaseContext(),testpins,
// Toast.LENGTH_SHORT).show();
私人布尔testWheelValue(INT ID,int值){
返回getWheel(ID).getCurrentItem()==值;
}
解决方案
V1
, V2
, V3
和 V4
的类型为 INT
,所以编译识别它们作为资源ID。试试这个:
text.setText(将String.valueOf(testpins));
Hey guys i cannot figure out the logic behind why my code is not working, apparently I am not allowed to print out these values in this way. I cannot display the values of v1,v2,v3 or v4 into a toast or a textfield, but i can display strings. Am i calling these values wrong? If you need me to post more code let me know.
testWheelValue(R.id.passw_1, v1);
testWheelValue(R.id.passw_2, v2);
testWheelValue(R.id.passw_3, v3);
testWheelValue(R.id.passw_4, v4);
testpins = v1 + v2 + v3 + v4;
text.setText(testpins);
// Toast.makeText(getBaseContext(), testpins,
// Toast.LENGTH_SHORT).show();
private boolean testWheelValue(int id, int value) {
return getWheel(id).getCurrentItem() == value;
}
解决方案
v1
, v2
, v3
, and v4
are of type int
, so the compile recognizes them as resource IDs. Try this:
text.setText(String.valueOf(testpins));
这篇关于显示方法的参数在一个TextView或吐司的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文