我有一個非常長的項目列表(超過200)和一個顯示列表的數據庫。我有一個點擊事件會比較,如果第一個項目是一個「蘋果」,然後當你點擊它,事實就出現了一個「蘋果」。問題是這個列表不是SET列表,這意味着單詞「apple」可能在第一個位置,或者它可能位於第18個位置。是否有一種比較大型物品清單的更簡單方法?
我開始做一個如果語句比較像這樣:
case 0:
if (text.equals("apple")) {
[show facts about apple]
} else if (text.equals("orange")) {
[show facts about orange]
//this would continue on to compare the ENTIRE LIST (about 500 lines per case)
break;
的問題是,我得到了一條錯誤:
The code of method onListItemClick(ListView, View, int, long) is exceeding the 65535 bytes limit
必須有一個更簡單的方法要做到這一點,對吧?
謝謝!該信息是有幫助的。 –