2014-03-12 90 views
0
// TODO Auto-generated method stub 
PostPaid x1 = (PostPaid)accountItems.get(arg2); 
String label = ""+x1.getTitle(); 
String uriBegin = "geo:" + x1.getLatitude() + "," + x1.getLongitude(); 
String query = x1.getLatitude() + "," + x1.getLongitude() + "(" + label + ")"; 
String encodedQuery = Uri.encode(query); 
String uriString = uriBegin + "?q=" + encodedQuery + "&z=16"; 
Uri uri = Uri.parse(uriString); 
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, uri); 
startActivity(intent); 
overridePendingTransition(R.anim.dux_sld_rght_in, R.anim.dux_sld_rght_out); 

我怎樣才能在薑餅做?作品kitkat但在gingertbread崩潰?薑餅Android的崩潰在地圖上

日誌下面是在意見中的要求....希望它有助於爲well./

03-12 08:51:46.343: E/AndroidRuntime(350): FATAL EXCEPTION: main 
03-12 08:51:46.343: E/AndroidRuntime(350): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=geo:24.746614456176758,46.680538177490234?q=24.746614456176758%2C46.680538177490234(al%20%20malaz)&z=16 } 
03-12 08:51:46.343: E/AndroidRuntime(350): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1409) 
03-12 08:51:46.343: E/AndroidRuntime(350): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379) 
03-12 08:51:46.343: E/AndroidRuntime(350): at android.app.Activity.startActivityForResult(Activity.java:2827) 
03-12 08:51:46.343: E/AndroidRuntime(350): at android.app.Activity.startActivity(Activity.java:2933) 
03-12 08:51:46.343: E/AndroidRuntime(350): at com.netvariant.zain.activity.StoresActivity$1.onItemClick(StoresActivity.java:126) 
03-12 08:51:46.343: E/AndroidRuntime(350): at android.widget.AdapterView.performItemClick(AdapterView.java:284) 
03-12 08:51:46.343: E/AndroidRuntime(350): at android.widget.ListView.performItemClick(ListView.java:3513) 
03-12 08:51:46.343: E/AndroidRuntime(350): at android.widget.AbsListView$PerformClick.run(AbsListView.java:1812) 
03-12 08:51:46.343: E/AndroidRuntime(350): at android.os.Handler.handleCallback(Handler.java:587) 
03-12 08:51:46.343: E/AndroidRuntime(350): at android.os.Handler.dispatchMessage(Handler.java:92) 
03-12 08:51:46.343: E/AndroidRuntime(350): at android.os.Looper.loop(Looper.java:123) 
03-12 08:51:46.343: E/AndroidRuntime(350): at android.app.ActivityThread.main(ActivityThread.java:3683) 
03-12 08:51:46.343: E/AndroidRuntime(350): at java.lang.reflect.Method.invokeNative(Native Method) 
03-12 08:51:46.343: E/AndroidRuntime(350): at java.lang.reflect.Method.invoke(Method.java:507) 
03-12 08:51:46.343: E/AndroidRuntime(350): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 
03-12 08:51:46.343: E/AndroidRuntime(350): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 
03-12 08:51:46.343: E/AndroidRuntime(350): at dalvik.system.NativeStart.main(Native Method) 
+0

後logcat的錯誤。 –

+0

完成後,檢查出 – user3278732

+0

值得注意,它在android薑餅模擬器上沒有設備崩潰。我在kitkat設備上測試過它,它工作正常,但是在仿真器薑餅上失敗 – user3278732

回答

0

您可以使用Intent.createChooser()方法來安全地啓動意圖。如果沒有可以處理您的意圖的應用程序,則會顯示一個對話框告訴用戶。

startActivity(Intent.createChooser(intent, "dialogTitle"));