当android中有空格时,自动完成不起作用的位置

当android中有空格时,自动完成不起作用的位置,android,Android,我是android新手,我已经实现了地图位置的自动完成。当我在没有空格的情况下输入时效果很好,但当我在有空格的情况下输入时,结果不会在android中显示 下面是我用于自动完成的代码 fromlocation.addTextChangedListener(new AutoCompleteTextWatcher(fromlocation,"from",fromPlacesDetailsList,fromPlacesAdapter,getApplicationContext(),googleRest

我是android新手,我已经实现了地图位置的自动完成。当我在没有空格的情况下输入时效果很好,但当我在有空格的情况下输入时,结果不会在android中显示

下面是我用于自动完成的代码

fromlocation.addTextChangedListener(new AutoCompleteTextWatcher(fromlocation,"from",fromPlacesDetailsList,fromPlacesAdapter,getApplicationContext(),googleRestGateway));
对于文本观察者:

@Override
public void afterTextChanged(Editable s) 
{
}

@Override
public void beforeTextChanged(CharSequence s, int start, int count,int after) 
{
}
@Override
public void onTextChanged(CharSequence placeInput, int start, int before, int count) 
{
    String place = placeInput.toString();
    if(place!=null && (place.length()>0 & place.length()<10))
    {
         {
             new AutoCompleteTask(placeDetails,adapter,appContext,googleRestGateway,textView).execute(place);
         }
    }


}

这是URL
https://maps.googleapis.com/maps/api/place/autocomplete/json?sensor=true&input=kr+puram&types=geocode&key=AIzaSyD3nw5uC7ptOT6Kq57GJ6SvFyW3mHcWfaY
。上面的代码在没有空格作为输入的情况下运行正常,但当我给空格时,结果会出现,但它们不会显示在emulator中。

尝试用%20替换空格,替换下面的代码

new AutoCompleteTask(placeDetails,adapter,appContext,googleRestGateway,textView).execute(place.replace(" ","%20"));

它工作正常。它下载数据,但不将其设置到适配器中。只需添加:

autoTextView.setAdapter(adapter);
synchronized (placesAdapter){
  placesAdapter.notifyDataSetChanged();
} 

它不工作了!!!。问题是我正在将响应放入PlacesAdapter,但是在执行autoTextView.setAdapter(PlacesAdapter)时;没有结果。请看我的回答:
autoTextView.setAdapter(adapter);
synchronized (placesAdapter){
  placesAdapter.notifyDataSetChanged();
}