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 8315439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:07:52+00:00 2026-06-08T21:07:52+00:00

I want to import these packages import com.google.android.maps.MapActivity; import com.google.android.maps.MapController; import com.google.android.maps.MapView; in my

  • 0

I want to import these packages
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;

in my mainactivity.java

But Eclipse cannot resolve these packages , and i don’t know the reason for this.

I’ve followed all the instructions i found on an e-book , step by step,on how to import maps in your app, and there is nothing mentioned about this error.

Here’s my files:

/////////// MainActivity.java /////////////////////

package com.paad.whereami;

import java.io.IOException;
import java.util.List;
import java.util.Locale;

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

import android.app.Activity;
import android.content.Context;
import android.location.Address;
import android.location.Criteria;
import android.location.Geocoder;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

public class MainActivity extends MapActivity {

//static final private int MENU_REFRESH = Menu.FIRST;

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

private LocationManager locationManager;
private String provider;
private Location location;

private final LocationListener locationListener = new LocationListener() {
    public void onLocationChanged(Location location) {
        updateWithNewLocation(location);
    }
    public void onProviderDisabled(String provider){
        updateWithNewLocation(null);
    }
    public void onProviderEnabled(String provider){ }
    public void onStatusChanged(String provider, int status, Bundle extras){ }
};

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.map_layout);
        mapView = (MapView)findViewById(R.id.map_view);

        locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);

        Criteria criteria = new Criteria();
        criteria.setAccuracy(Criteria.ACCURACY_FINE);
        criteria.setAltitudeRequired(false);
        criteria.setBearingRequired(false);
        criteria.setCostAllowed(true);
        criteria.setPowerRequirement(Criteria.POWER_LOW);
        provider = locationManager.getBestProvider(criteria, true);
        location = locationManager.getLastKnownLocation(provider);

    //Log.v("BEFORE", "Location is: " + location);
    updateWithNewLocation(location);
    //Log.v("AFTER", "LOCATION FOUND");
    locationManager.requestLocationUpdates(provider, 2000, 10, locationListener);
    }

    private void updateWithNewLocation(Location location){
        String latLongString;
        TextView myLocationText;
        myLocationText = (TextView)findViewById(R.id.myLocationText);

        String addressString = "No address found";

        if (location != null) {
        double lat = location.getLatitude();
        double lng = location.getLongitude();
        latLongString = "Lat:" + lat + "\nLong:" + lng;

        //double latitude = 73.147536;
        //double longitude = 0.510638;
        Geocoder gc = new Geocoder(this, Locale.getDefault());

        try {
            List<Address> addresses = gc.getFromLocation(lat, lng, 1);
            Log.v("TRY_BODY", "All addresses are: " + addresses);
            StringBuilder sb = new StringBuilder();
            if (addresses.size() > 0) {
                Log.v("IF_BODY", "All addresses are: " + addresses);
                Address address = addresses.get(0);
                for (int i = 0; i < address.getMaxAddressLineIndex(); i++){
                    sb.append(address.getAddressLine(i)).append("\n");
                    sb.append(address.getLocality()).append("\n");
                    sb.append(address.getPostalCode()).append("\n");
                    sb.append(address.getCountryName());
                }
                addressString = sb.toString();
            }
        } catch (IOException e) {}
        } 
        else {
        latLongString = "No location found";
        }

        myLocationText.setText("Current Pos:\n"+latLongString+"\n"+addressString);
    }

}

//////////// main.xml /////////////////

<?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">
  <TextView  
    android:id="@+id/myLocationText"
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/hello"
  />

  <com.google.android.maps.MapView
android:id="@+id/myMapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="@string/myMapKey"
/>

</LinearLayout>

////////////// Manifest.xml ////////////////

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.paad.whereami"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="4"
        android:targetSdkVersion="15" />

    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.INTERNET"/>

        <application
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name"
            android:theme="@style/AppTheme" >

            <uses-library android:name="com.google.android.maps"/>

            <activity
                android:name=".MainActivity"
                android:label="@string/title_activity_main" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />

                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
        </application>

</manifest>

Thanks in advance.

  • 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-06-08T21:07:54+00:00Added an answer on June 8, 2026 at 9:07 pm

    Right click on your projects —> properties —> android –> select target name Google ApIs. And Clean projects and Build the projects.

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

Sidebar

Related Questions

Activity where I want to use: import com.google.android.maps.MapActivity; import com.google.android.maps.MapView; public class BankoTinklasMap extends
i want to import org.apache.commons.io but i'm getting this error: [info] Compiling 1 Java
i want to store images in \mnt\sdcard package com.Downld_file_frm_net; import java.io.BufferedInputStream; import java.io.File; import
I want to use these two classes from lucene - import org.apache.lucene.analysis.snowball.*; import org.apache.lucene.analysis.PorterStemmer;
i want to import csv file to mysql database. the upload was success. but
Hi I have an INFILE I want to import, but the dates are of
I want to import an XML file from polarpersonaltrainer.com that stores heartrate data into
I was following this example: http://developer.android.com/resources/tutorials/views/hello-autocomplete.html And I want to know how I can
I want to read (only) records from data/data/com.android.providers.telephony/databases/mmssms.db (I know no official API, etc.
I was reading over http://android-developers.blogspot.com/2009/04/backward-compatibility-for-android.html But I'm really not grasping how to ignore certain

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.