Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: issue with Intent while I want to take the map Uri and go to GoogleMap or browser to show the location

Arash:

I'm trying to get the Longitude and Latitude and Intent user to the map but I get an error, I've searched in Stack and my method are exactly the same as other people, but I get crash when I call startActivity(intent) method.

here's my code:


public void routReq(View view) {

if(saloon.getEntity_address() != null) {

String uri = "http://maps.google.com/maps?q=loc: " + saloon.getEntity_address().getLatitude()+","+saloon.getEntity_address().getLongitude()+"&mode=d";

Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse(uri));
intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
startActivity(intent);
} else {
Snackbar.make(view, "there's no map for this place!", Snackbar.LENGTH_LONG).show();
}

}

and this is the cause android studio gave me:

Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.google.android.apps.maps/com.google.android.maps.MapsActivity}; have you declared this activity in your AndroidManifest.xml?

which I did declare in Manifest.


android:theme="@style/viewSaloneTheme"
android:name="ir.drax.beautyTime.Activities.ViewSalon"
android:screenOrientation="portrait" />

and also:

Caused by: java.lang.reflect.InvocationTargetException



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered
HERE


This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: issue with Intent while I want to take the map Uri and go to GoogleMap or browser to show the location

×

Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription

×