Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7699023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:22:53+00:00 2026-05-31T22:22:53+00:00

Hello I am developing a map view I tried to following way I created

  • 0

Hello I am developing a map view I tried to following way
I created an “Intent” by clicking on a button]. Added permission and library
. I created an overlay item.
.My Emulator is targeted as GoogleApi 2.3.3 .My MapView key is obdained and asigned into mapview.xml

I am seeing the map with a google logo at bottom and map view controler: here is my code

MapView.xml

<?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >
    <view android:id="@+id/mv"
    class="com.google.android.maps.MapView"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_weight="1" 
    android:clickable="true"
    android:apiKey="046S_m5BQ43JIRtKiXQfldWwo2ddlU6dL6ca9SQ"
    />
    </LinearLayout>

MapViewActivity.java

    public class MapviewActivity extends MapActivity
   { private static double lat = 35.952967;   // Temporary test values for lat/long
    private static double lon = -83.929158 ;
    private int latE6;
   private int lonE6;
  private MapController mapControl;
private GeoPoint gp;
private MapView mapView; 
private LocationManager locationManager;
private MyOverlays itemizedoverlay;
private MyLocationOverlay myLocationOverlay;


    @Override
    public void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        //requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.mapview);

        mapView = (MapView) findViewById(R.id.mv);
        mapView.setBuiltInZoomControls(true);
        mapView.setSatellite(true);
        mapControl = mapView.getController();
        mapControl.setZoom(12); // Zoon 1 is world view
        locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
        locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0,
                0, new GeoUpdateHandler());

        myLocationOverlay = new MyLocationOverlay(this, mapView);
        mapView.getOverlays().add(myLocationOverlay);

        myLocationOverlay.runOnFirstFix(new Runnable() {
            public void run() {
                mapView.getController().animateTo(
                        myLocationOverlay.getMyLocation());
            }
        });

        Drawable drawable = this.getResources().getDrawable(R.drawable.point);
        itemizedoverlay = new MyOverlays(this, drawable);
        createMarker();
    }



    public class GeoUpdateHandler implements LocationListener {

        @Override
        public void onLocationChanged(Location location) {
            int lat = (int) (location.getLatitude() * 1E6);
            int lng = (int) (location.getLongitude() * 1E6);
            GeoPoint point = new GeoPoint(lat, lng);
            createMarker();
            mapControl.animateTo(point); // mapController.setCenter(point);

        }

        @Override
        public void onProviderDisabled(String provider) {
        }

        @Override
        public void onProviderEnabled(String provider) {
        }

        @Override
        public void onStatusChanged(String provider, int status, Bundle extras) {
        }
    }

    private void createMarker() {
        GeoPoint p = mapView.getMapCenter();
        OverlayItem overlayitem = new OverlayItem(p, "", "");
        itemizedoverlay.addOverlay(overlayitem);
        if (itemizedoverlay.size() > 0) {
            mapView.getOverlays().add(itemizedoverlay);
        }
    }

    @Override
    protected void onResume() {
        super.onResume();
        myLocationOverlay.enableMyLocation();
        myLocationOverlay.enableCompass();
    }

    @Override
    protected void onPause() {
        super.onResume();
        myLocationOverlay.disableMyLocation();
        myLocationOverlay.disableCompass();
    }




    // to set the satellite and traffic view
    public boolean onKeyDown(int keyCode, KeyEvent e){
    if(keyCode == KeyEvent.KEYCODE_S){
        mapView.setSatellite(mapView.isSatellite());
        return true;
    } else if(keyCode == KeyEvent.KEYCODE_T){
        mapView.setTraffic(mapView.isTraffic());
        mapControl.animateTo(gp);  // To ensure change displays immediately
    }
    return(super.onKeyDown(keyCode, e));
}     
// Required method since class extends MapActivity
protected boolean isRouteDisplayed() {
    return true;  // display a route
}

here is my MyOverlays.java

 public class MyOverlays extends ItemizedOverlay<OverlayItem> {

        private static int maxNum = 5;
        private OverlayItem overlays[] = new OverlayItem[maxNum];
        private int index = 0;
        private boolean full = false;
        private Context context;
        private OverlayItem previousoverlay;

        public MyOverlays(Context context, Drawable defaultMarker) {
            super(boundCenterBottom(defaultMarker));
            this.context = context;
        }

        @Override
        protected OverlayItem createItem(int i) {
            return overlays[i];
        }

        @Override
        public int size() {
            if (full) {
                return overlays.length;
            } else {
                return index;
            }

        }

        public void addOverlay(OverlayItem overlay) {
            if (previousoverlay != null) {
                if (index < maxNum) {
                    overlays[index] = previousoverlay;
                } else {
                    index = 0;
                    full = true;
                    overlays[index] = previousoverlay;
                }
                index++;
                populate();
            }
            this.previousoverlay = overlay;
        }

        protected boolean onTap(int index) {
            OverlayItem overlayItem = overlays[index];
            Builder builder = new AlertDialog.Builder(context);
            builder.setMessage("This will end the activity");
            builder.setCancelable(true);
            builder.setPositiveButton("I agree", new OkOnClickListener());
            builder.setNegativeButton("No, no", new CancelOnClickListener());
            AlertDialog dialog = builder.create();
            dialog.show();
            return true;
        };

        private final class CancelOnClickListener implements
                DialogInterface.OnClickListener {
            public void onClick(DialogInterface dialog, int which) {
                Toast.makeText(context, "You clicked yes", Toast.LENGTH_LONG)
                        .show();
            }
        }

        private final class OkOnClickListener implements
                DialogInterface.OnClickListener {
            public void onClick(DialogInterface dialog, int which) {
                Toast.makeText(context, "You clicked no", Toast.LENGTH_LONG).show();
            }
        }
    }

My Android.manifest

<uses-sdk android:minSdkVersion="10" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/>

     <application
        android:icon="@drawable/drive_eat_icon"
        android:label="@string/app_name" android:allowClearUserData="true"        android:debuggable="true">
        <activity
            android:name=".MainScreen"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".DriveatmapActivity"></activity>
        <activity android:name=".MapviewActivity"></activity>
        <activity android:name=".FoodjointListActivity"></activity>
        <activity android:name=".SubmitFormActivity"></activity>    
        <activity android:name=".MyOverlays"/>
            <uses-library android:required="true" android:name="com.google.android.maps"></uses-library>
</application>

please suggest what to do . if you need any code please let me know.
I am seeing the google map with only grey tiles.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T22:22:55+00:00Added an answer on May 31, 2026 at 10:22 pm

    Use it to get the Valid API key–

    that is the exact path–

    keytool -list -keystore "C:\Users\XYZ\.android\debug.keystore"
    

    Total path for cmd prompt to get the MD5 fingureprint for the GoogleMap API Key—-

    if you are using eclipse then–

    D:\eclipse\jre\bin>keytool -list -keystore "C:\Users\XYZ\.android\debug.keystore"
    

    MD5 fingurePrint will look like this–

     3E:F4:D6:E6:93:4D:BB:B8:62:3A:D6:0F:E0:FC:4C:65
    

    When u get the fingurePrint number afterthat to get the API Key use this link—

    http://code.google.com/android/add-ons/google-apis/maps-api-signup.html

    Then u will get API key of your system and can get the Map easily instread of grids….

    Use this key in your MapView.xml—

     <?xml version="1.0" encoding="utf-8"?>
        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
         android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >
    
      <com.google.android.maps.MapView
          xmlns:android="http://schemas.android.com/apk/res/android"
          android:id="@+id/map"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:clickable="true"
          android:enabled="true"
          android:apiKey="046S_m5BQ43JIRtKiXQfldWwo2ddlU6dL6ca9SQ" />
    
    </LinearLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello friends I am developing application in which view has one textField & 2
Hello I have the following error by git-fsck, which cannot be cleaned by git-gc
Hello again ladies and gents! OK, following on from my other question on ASP.NET
Hello I am developing one wpf application. I am using linq to sql for
Hello, everybody. We are developing an iPhone app which supported by a server-side that
Hello I'm in the process of developing a running log in WinForms. I would
Hello Everyone, I am developing an app which have to show all the restaurants
Hello i am new in developing Android applications, I need to create an application
Hello fellow stackies, I'm developing a site and I have a small problem. It's
Hello I'm currently having an issue with a timer in a program I'm developing.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.