2

I have created the Application in which i m Using MapView. Now i want to Use the Back Button in My that MapView. I have develop the Layout but it cant seen the Button over mapview. When i push back button from Emulator then the Mapview become close and the Back button is shown. Can anybudy help me How to Show Back Button on the MapView. ? Thanks.

richq
  • 55,548
  • 20
  • 150
  • 144
  • Shreyash, can not tag your questions "android-ndk" if they are not related with the NDK please? Thanks. http://developer.android.com/sdk/ndk/index.html – richq Apr 20 '11 at 13:50

2 Answers2

2

Bo basically it may be possible with the overlays but I have done it using RelativeLayout stuff

<RelativeLayout
    android:id="@+id/headerlayout" 
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" android:layout_alignParentTop="true"
    android:layout_alignParentLeft="true"
    >

    <Button android:id="@+id/amap_back_btn" android:layout_width="wrap_content"
        android:layout_height="wrap_content" android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true" android:text="Back">
    </Button>

</RelativeLayout>

<MapViewActivity
    xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mapview"
    android:layout_width="wrap_content" android:layout_height="wrap_content"
    android:clickable="true" android:apiKey="your map key"
    android:layout_below="@+id/headerlayout"
    android:layout_above="@+id/bottomlayout" 
    />

This is all If you find it correct dont forget to mark my answer as check. Best Regards,Anup

Anup Rojekar
  • 1,093
  • 9
  • 29
  • 1
    Is SkyTracMapView is your Activity ? –  Apr 18 '11 at 08:07
  • Will u explain me what is this : –  Apr 18 '11 at 08:10
  • ya basically it is a activity class extending MapActivity public class MapScreen extends MapActivity like this . – Anup Rojekar Apr 18 '11 at 08:11
  • or you can add your mapview there. – Anup Rojekar Apr 18 '11 at 08:16
  • but its not working with mine. I have Build the Appliction for the getting Direction. And have Use the WebView to set the Direction. in Which i m giving the Source and destination address in the link. –  Apr 18 '11 at 08:18
  • Now I dont understand why you are using webview now. what exactly you want to implement, please be clear on it, I kindly request please do not waste you as well as others precious time. – Anup Rojekar Apr 18 '11 at 08:19
0

You will need to use an overlay to add the back button on the MapView. Have a look at this tutorial which explains on how to add overlays. http://www.anddev.org/viewtopic.php?t=92

rogerstone
  • 7,541
  • 11
  • 53
  • 62
  • Thanks. But i want to set the Header part in the Application and i want to set that header part on the Map View. . . Is it Possible to set with the Overlay ? ?? –  Apr 18 '11 at 07:28
  • What do you mean by header part.Do you mean that you want to set the title on the Mapview?If that is what you want you can. – rogerstone Apr 18 '11 at 07:31
  • 1
    I have set the Header View in My Every activity. where i have set the Back and Menu buttons. There are some other buttons also if i want to set. There is also the Title of the Page. Hope you get my idea. Now is it Possible by the Overlay ??? –  Apr 18 '11 at 07:34