下面的代码工作正常,但突然我在执行TextAutosuggestionrequest
时遇到了Java运行时异常
这是我的代码:
searchinfo.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
adapter=new ArrayAdapter<AutoSuggest>(getApplicationContext(),android.R.layout.simple_list_item_1,
listItems);
searchitems.setVisibility(View.VISIBLE);
listItems.clear();
if (!searchinfo.getText().toString().isEmpty()) {
try {
TextAutoSuggestionRequest request1 = null;
if (map != null){
GeoCoordinate geo = new GeoCoordinate(SDLocation.getInstance().getLocation().getLatitude(), SDLocation.getInstance().getLocation().getLatitude());
request1 = new TextAutoSuggestionRequest(s.toString()).setSearchCenter(geo);
} else {
GeoCoordinate geo = new GeoCoordinate(SDLocation.getInstance().getLocation().getLatitude(), SDLocation.getInstance().getLocation().getLatitude());
request1 = new TextAutoSuggestionRequest(s.toString()).setSearchCenter(geo);
}
request1.execute(new ResultListener<List<AutoSuggest>>() {
@Override
public void onCompleted(List<AutoSuggest> autoSuggests, ErrorCode error) {
if (error == ErrorCode.NONE) {
if (autoSuggests.size() > 0) {
//searchlist = autoSuggests;
for (int i = 0; i < autoSuggests.size(); i++) {
listItems.add(autoSuggests.get(i).getTitle());
}
}
if (listItems!= null && !searchinfo.getText().toString().isEmpty()) {
updatelist();
searchitems.setAdapter(adapter); }
searchitems.setEnabled(true);
} else {
// CCLog.d("offline","error ");
}
}
});
} catch (IllegalArgumentException ex) {
Log.d("MY",""+ex);
//Handle invalid create search request parameters
} catch (UnintializedMapEngineException e) {
Log.d("MY",""+e);
//CCLog.d("offli;ne","error ")
}
}else{
updatelist();
}
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
// TODO Auto-generated method stub
}
@Override
public void afterTextChanged(Editable s) {
// TODO Auto-generated method stub
}
});
这是我的错误日志
05-17 10:20:09.152 13938-14344 / com.benz.event.navigation E / NETWORK: 请求: https://places.hybrid.api.here.com/places/v1/meta/offline?app_id=sMeOyVw8rmO9kfHS4eSB&app_code=o-KMBFm4CNHIqv55LMKyBQ 错误:400错误请求05-17 10:20:09.321 13938-14748 / com.benz.event.navigation E / art:没有 (Ljava / lang / String;)V in java.lang.Class 05-17 10:20:09.332 13938-14766 / com.benz.event.navigation E / art:没有 (Ljava / lang / String;)V in java.lang.Class 05-17 10:20:09.336 13938-14748 /? E / AndroidRuntime:FATAL EXCEPTION:AsyncTask#3 处理:com.benz.event.navigation,PID:13938 java.lang.RuntimeException:执行时发生错误 doInBackground() 在android.os.AsyncTask $ 3.done(AsyncTask.java:309) 在java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354) at java.util.concurrent.FutureTask.setException(FutureTask.java:223) 在java.util.concurrent.FutureTask.run(FutureTask.java:242) 在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:588) 在java.lang.Thread.run(Thread.java:818) 引起:java.lang.NoSuchMethodError:没有非静态方法 “Ljava /郎/ AssertionError异常;(Ljava /郎/字符串;)V” at com.nokia.maps.PlacesBaseRequest.poll(Native Method) 在com.nokia.maps.PlacesBaseRequest.e(PlacesBaseRequest.java:62) 在com.nokia.maps.PlacesBaseRequest $ b.a(PlacesBaseRequest.java:732) 在com.nokia.maps.PlacesBaseRequest $ b.doInBackground(PlacesBaseRequest.java:713) 在android.os.AsyncTask $ 2.call(AsyncTask.java:295) 在java.util.concurrent.FutureTask.run(FutureTask.java:237) 在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:588) 在java.lang.Thread.run(Thread.java:818)
任何支持都会非常有用。