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);

How can I get this done in gingerbread? works on kitkat but crashes in gingertbread?

log below as requested in the comments.... hope it helps as 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)
Racil Hilan
  • 24,690
  • 13
  • 50
  • 55
user3278732
  • 1,694
  • 10
  • 31
  • 67

1 Answers1

0

You can use Intent.createChooser() method to safely launch the Intent. If no application exists that can handle your intent, a dialog will be displayed telling the user just that.

startActivity(Intent.createChooser(intent, "dialogTitle"));
prasad thangavel
  • 173
  • 1
  • 2
  • 11