我有一个基于this扩展IntentService的类。 我将不胜感激任何帮助。
//This is the method in my main activity that throws exception. I wanted this to call the IntentService by passing the autocompletetextview text within the Intent.The content is Lat and Lon coordinate I would like to reverse geocode in the IntentService Handler.
protected void startIntentService(String passedst) {
try{
if (passedst != null){
//acrilocation = (AutoCompleteTextView) findViewById(R.id.actvriderlocation);
Intent myintent = new Intent(this, FetchAddressIntentService.class);
myintent.putExtra(Constants.RECEIVER, mResultReceiver);
myintent.putExtra(Constants.LOCATION_DATA_EXTRA, Location.convert(passedst));
startService(myintent);
}
}catch (Exception e){
Log.i(LOG_TAG, "There is a problem with your arguments");
}
}
这是logcat片段,这是为了响应我提供的完整logcat详细信息的请求
02-17 23:38:09.883: D/AbsListView(16456): onDetachedFromWindow
02-17 23:38:09.933: E/MoreInfoHPW_ViewGroup(16456):
Parent view is not a TextView
02-17 23:38:09.943: I/Google Maps Android API(16456): Google Play services package version:
6599036
02-17 23:38:09.973: D/AbsListView(16456): Get MotionRecognitionManager
02-17 23:38:10.013: W/IInputConnectionWrapper(16456):
showStatusIcon on inactive InputConnection
02-17 23:38:10.043: E/ViewRootImpl(16456): sendUserActionEvent() mView == null
02-17 23:38:10.543:
D/dalvikvm(16456): GC_FOR_ALLOC freed 14454K, 50% free 16195K/32228K, paused 81ms, total 81ms
02-17 23:38:12.013: W/System.err(16456):
java.lang.IllegalArgumentException: coordinate=46.6667777, 122.5556666
答案 0 :(得分:0)
由于抛出异常,我认为问题很可能就是你要传递的字符串 这里是来自developer site。
的Location.convert以FORMAT_DEGREES描述的格式之一转换字符串, FORMAT_MINUTES,或FORMAT_SECONDS为双。
如果coordinate为null,则抛出NullPointerException 如果坐标不在其中一个有效范围内,则为IllegalArgumentException 格式。
您可能想要检查传递的字符串。