我在想我可以接受我从两者中获得的用户输入并将其AutoCompleteTextView显示为结果,其中有一个TableLayout.
需要的两个输入AutoCompleteTextView是来自用户的我的位置和目的地。复杂性来自AutoCompleteTextView生成的输入类型。使用来自 Google,因此我正在使用AutoCompleteTextViewJamal , Kathmandu, Central Region, Nepal和Kalanki, Kathmandu, Central Region, Nepal等输入。我想要反映的是结果:从...到...PlacesAutoCompleteTableLayout
我的问题是我怎样才能在Jamal, Kathmandu, Central Region, Nepal中输入字符串的第一部分,这只是Jamal来TableLayout显示结果,例如Results: From Jamal to 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. 我真的不知道发生了什么事。请帮忙 ?