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

  • Home
  • SEARCH
  • 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 6929921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:22:47+00:00 2026-05-27T11:22:47+00:00

I want to make GPS app and I’m starting with this code which is

  • 0

I want to make GPS app and I’m starting with this code which is copy paste from another tutorial. But when I test the app it blank space and the map doesn’t appear! Can any one help please??!!

Here is the code

 package com.manita.mapuse;

import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.view.KeyEvent;
import android.widget.Toast;

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



 public class MapuseActivity extends MapActivity implements LocationListener {
     private MapView  mapView = null;
     private LocationManager  lm = null;
     private double lat = 0;
     private double lng = 0;
     private MapController mc = null;

     @Override
     public void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     setContentView(R.layout.main);
     mapView = (MapView) this.findViewById(R.id.mapView);
     mapView.setBuiltInZoomControls(true);

     lm = (LocationManager) this.getSystemService(LOCATION_SERVICE);
     lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 10000, 0, this);
     lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 10000, 0, this);

     mc = mapView.getController();
     mc.setZoom(12);
     }

     @Override
     protected boolean isRouteDisplayed()
     {
     return false;
     }

     @Override
     public boolean onKeyDown(int keyCode, KeyEvent event)
     {
     if (keyCode == KeyEvent.KEYCODE_S)
     {
     mapView.setSatellite(!mapView.isSatellite());
     return true;
     }
     return super.onKeyDown(keyCode, event);
     }

     @Override
     public void onLocationChanged(Location location)
     {
     lat = location.getLatitude();
     lng = location.getLongitude();
     Toast.makeText(getBaseContext(),
     "Location change to : Latitude = " + lat + " Longitude = " + lng,
     Toast.LENGTH_SHORT).show();
     GeoPoint p = new GeoPoint((int) (lat * 1E6), (int) (lng * 1E6));
     mc.animateTo(p);
     mc.setCenter(p);
     }

     @Override
     public void onProviderDisabled(String provider)
     {
     // TODO Auto-generated method stub

     }

     @Override
     public void onProviderEnabled(String provider)
     {
     // TODO Auto-generated method stub

     }

     @Override
     public void onStatusChanged(String provider, int status, Bundle extras)
     {
     // TODO Auto-generated method stub

     }
 }

Here is the manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.manita.mapuse"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="7" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <uses-library android:name="com.google.android.maps" />
        <activity
            android:label="@string/app_name"
            android:name=".MapuseActivity" >
             <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_GPS" />
<uses-permission android:name="android.permission.LOCATION" />
</manifest>

and this is my MainActivity.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mainlayout"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <com.google.android.maps.MapView
 android:id="@+id/mapView"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
 android:enabled="true"
 android:clickable="true"
 android:apiKey="@string/mapKey"
 />
    <LinearLayout android:id="@+id/zoom" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_alignParentBottom="true" 
        android:layout_centerHorizontal="true" 
        /> 

</RelativeLayout>

Thank you.

  • 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-27T11:22:48+00:00Added an answer on May 27, 2026 at 11:22 am

    I assume you’re testing the code on emulator. Have a look at this: http://blogspot.fluidnewmedia.com/2009/04/displaying-google-maps-in-the-android-emulator/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want make sql query which will insert values from one table to another
I want to make a copy of an ActiveRecord object, changing a single field
I want to make an entity that has an autogenerated primary key, but also
I want to make a .NET Form as a TopMost Form for another external
i want make function like that function(data){ } i want this data as this
I want to update a MapView in an iPhone app. Using a geocordinate, this
I want to make some graphical dialogs for my script but don't know how.
I want make this effection: a{color:#000;} , when I make a a:hover, the hyperlinked
I want make an irssi script which will notice of new files on server,
I want to make application that will use GPS, as we know at first

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.