Reputation: 2575
The Google map was displayed but on loading the map, the title bar gets disappeared. Is there any solution to display the title bar?
private void calc_short_Distance() {
String uri = "http://maps.google.com/maps?saddr=" + currentLatitude+","+currentLongitude+"&daddr="+fixedLatitude+","+fixedLongitude;
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri));
intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
//***Title bar displayed upto here and after loading intent it disappear
startActivity(intent);
}
Manifest code is here and main activity class is here.
Upvotes: 2
Views: 1212
Reputation: 57326
Your title bar is not shown over the map because you open the map as the Maps application. Now when the map is displayed, it's not your application any more, but instead Google's app. If you want to control how the map is shown, then you need to create your own activity with a MapView
on it and use MapView
API to draw your directions, etc. Your pseudo-XML may look like this:
<LinearLayout android:orientation="vertical">
<!--
Whatever you want at the top
-->
<MapView android:layout_width="match_parent" android:layout_height="match_parent" />
</LinearLayout>
Then you'll need to create your activity by extending MapActivity
and using this XML for its content view. You can then use the MapView
API to display any overlays you need. You'll also need to obtain an API key to use with maps. Have a look at Google's MapView tutorial for more information on how to code this activity.
Once you have the map activity, then use the intent to start this map activity instead of the google map app.
Upvotes: 1