崩溃在地图上的姜饼机器人

时间:2014-03-12 06:48:56

标签: android android-2.3-gingerbread

// 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崩溃?

按照评论中的要求在下面记录....希望它也有帮助./

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)

1 个答案:

答案 0 :(得分:0)

您可以使用Intent.createChooser()方法安全地启动Intent。如果不存在可以处理您的意图的应用程序,则会显示一个对话框,告诉用户。

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