我在想,我可以從兩個AutoCompleteTextView
中獲取用戶輸入,並將其顯示爲TableLayout
。字符串數組:顯示結果
兩個輸入該AutoCompleteTextView
需要的是我的位置和目標從用戶。複雜性來自AutoCompleteTextView
生成的輸入類型。 AutoCompleteTextView
使用Google的PlacesAutoComplete
,因此我正在使用像Jamal,加德滿都,中部地區,尼泊爾和也許Kalanki,加德滿都,中部地區,尼泊爾。我想在TableLayout
反映是結果:從...到...
我的問題是如何才能採取字符串的第一部分中賈馬爾,加德滿都,中部地區,尼泊爾這只是Jamal爲TableLayout
顯示結果如結果:從Jamal到Kalanki。對android來說很新穎我有點含糊不清,我試過的代碼看起來像這樣。
String[] from;
String[] to;
//pulling the auto complete text view
from = location.getString().toText();
to = destination.getString().toText();
//referencing the text view inside the table layout
results.setText(new StringBuilder().append("Results from"+from[0]).append(" to"+to[0]));
此代碼明顯,因爲它促使我改變from
到String
不起作用。我真的不知道發生了什麼事。請幫忙 ?
不知道這些數組聲明是做什麼的,但它們不會編譯。 – Keppil 2013-04-11 06:50:31
謝謝,我編輯了我的答案 – jimpanzer 2013-04-11 06:51:55
@Keppil,感謝您指出了錯誤。 – jimpanzer 2013-04-11 06:58:22