android - Not able to add Intent to Google Maps inside ArrayAdapter -


i have code list items references , have address. need make such when item of list clicked, google maps navigation should launched corresponding address rowitem. btw address won't visible within row, address object row information taken. have tried code :-

rowview.setonclicklistener(new view.onclicklistener()      {         public void onclick(view v)          {             //intent intent = new intent(context,);             //toast.maketext(context, "yeah boy", toast.length_short).show();             latlng tmp = objects.get(position).location;             string uri = "http://maps.google.com/maps?saddr=" + location.getlatitude()+","+location.getlongitude()+"&daddr="+tmp.latitude+","+tmp.longitude;               intent intent = new intent(android.content.intent.action_view, uri.parse(uri));             intent.setclassname("com.google.android.apps.maps", "com.google.android.maps.mapsactivity");             context.startactivity(intent);         }     });     return rowview; 

but doesn't seem working. i'm having error :-

android.util.androidruntimeexception: calling startactivity() outside of activity  context requires flag_activity_new_task flag. want? 

can me this. in advance.

try :

intent intent = new intent(); intent.setaction(intent.action_view); string uri = "your uri string "; intent.setdata(uri.parse(uri)); intent.setclassname("com.google.android.apps.maps",                   "com.google.android.maps.mapsactivity"); intent.setflags(intent.flag_activity_new_task); context.startactivity(intent); 

Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -