I don't know what i always seem to end up doing wrong but it is quite
irritating now and
it is second time i am posting on same topic.
Please if anyone can take time to read the following code and guide me
that what is lacking i would be highly obliged

Manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android";
      package="org.mymapinapi"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/
app_name">
      <uses-library android:name="com.google.android.maps" />
        <activity android:name=".mymapinapi"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category
android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
<uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
    </application>
    <uses-sdk android:minSdkVersion="7" />

</manifest>


                                             Main.xml :-
The layout contains two linear layouts.
The first one has 5 buttons in horizontal layout and second one has
simple mapview wih google api

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <Button android:id="@+id/zoomin"
            android:text="+"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

    <Button android:id="@+id/zoomout"
            android:text="-"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

    <Button android:id="@+id/satellite"
            android:text="Satellite"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

    <Button android:id="@+id/street"
            android:text="Street"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

    <Button android:id="@+id/traffic"
            android:text="Traffic"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />


</LinearLayout>

<LinearLayout android:id="@+id/LinearLayout01"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content">
              <com.google.android.maps.MapView android:id="@+id/mymap"
                        android:layout_width="fill_parent"
                        android:layout_height="fill_parent"
 
android:apiKey="033PkWkCKskK50UfVjdjehD71XJ55xuDOEassDQ" /></
LinearLayout>


</LinearLayout>


                                                          Main Java
file :-

package org.mymapinapi;


import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class mymapinapi extends MapActivity {
        MapView mv;
        Button btn1,btn2,btn3,btn4,btn5;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    mv=(MapView)findViewById(R.id.mymap);
    btn1=(Button)findViewById(R.id.zoomin);
    btn2=(Button)findViewById(R.id.zoomout);
    btn3=(Button)findViewById(R.id.satellite);
    btn4=(Button)findViewById(R.id.street);
    btn5=(Button)findViewById(R.id.traffic);

    btn1.setOnClickListener(new OnClickListener(){

                @Override
                public void onClick(View v) {
                        // TODO Auto-generated method stub
                        mv.getController().zoomIn();

                }

    });

    btn2.setOnClickListener(new OnClickListener(){

                @Override
                public void onClick(View v) {
                        // TODO Auto-generated method stub
                        mv.getController().zoomOut();

                }

    });

    btn3.setOnClickListener(new OnClickListener(){

                @Override
                public void onClick(View v) {
                        // TODO Auto-generated method stub
                        mv.setStreetView(false);
                        mv.setTraffic(false);
                        mv.setSatellite(true);

                }

    });

    btn4.setOnClickListener(new OnClickListener(){

                @Override
                public void onClick(View v) {
                        // TODO Auto-generated method stub
                        mv.setStreetView(true);
                        mv.setTraffic(false);
                        mv.setSatellite(false);

                }

    });

    btn5.setOnClickListener(new OnClickListener(){

                @Override
                public void onClick(View v) {
                        // TODO Auto-generated method stub
                        mv.setStreetView(false);
                        mv.setTraffic(true);
                        mv.setSatellite(false);

                }

    });
    }

        @Override
        protected boolean isRouteDisplayed() {
                // TODO Auto-generated method stub
                return false;
        }
}

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to