Accessing Google Maps Navigation from Android Application -
i know question has been asked multiple times, i'm stuck. trying use intent pass edittext value google maps use outside of app. have basic syntax need, not sure pass in address. i'm wanting use regular address , not latitude/longitude.
the code have launch google maps is
public void sendmessage(view view) { intent intent = new intent(android.content.intent.action_view, uri.parse("http://maps.google.com/maps?daddr=address")); startactivity(intent); }
and xml value want passed in...
<edittext android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/addressedittext" android:layout_weight=".5" android:layout_marginright="50dp" android:layout_marginbottom="-10dp" android:textcolor="@android:color/primary_text_light" android:singleline="true" android:padding="1dp" android:scaletype="centercrop" android:croptopadding="true" android:background="@drawable/border_image"/> <button android:id="@+id/routebutton" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginleft="-60dp" android:layout_marginright="40dp" android:layout_marginbottom="-10dp" android:layout_margintop="-10dp" android:layout_weight=".4" android:text="route" android:textcolor="#fff" android:textsize="16sp" android:onclick="sendmessage" />
i'm wanting take text input in address's edittext box , put google maps navigation destination using current location upon clicking "route" button. appreciated!
you should extract string edittext , attach uri this:
string map = "http://maps.google.co.in/maps?q=" + youraddress; intent intent = new intent(intent.action_view, uri.parse(map)); startactivity(intent);
Comments
Post a Comment