2012-07-21 16 views
0

嘿傢伙我無法弄清楚爲什麼我的代碼不工作的邏輯,顯然我不允許以這種方式打印出這些值。我無法將v1,v2,v3或v4的值顯示在烤麪包或文本框中,但我可以顯示字符串。我是否稱這些值錯誤? 如果您需要我發佈更多的代碼,請告訴我。在textview或toast中顯示方法的參數

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; 
    } 

回答

1

v1v2v3v4int類型,因此編譯它們識別爲資源ID。試試這個:

text.setText(String.valueOf(testpins)); 
+0

非常感謝你!我不顯示即時尋找的值,但我的應用程序不再強制關閉。 – 2012-07-21 18:04:29