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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T07:47:42+00:00 2026-06-07T07:47:42+00:00

I am trying to create an informational Activity, which displays a location on google’s

  • 0

I am trying to create an informational Activity, which displays a location on google’s MapView among other things. Whenever I navigate through this MapActivity, then click the back button, I get the following error:

“… Caused by: java.lang.IllegalStateException: You are only allowed to have a single MapView in a MapActivity…”

Things you should know! :

onResume calls my setUpDisplay which initializes my MapView in a LinearLayout:

…

        List<Address> geoResults = geocoder.getFromLocationName(formalAddress, 1);
    while (geoResults.size()==0) 
    {
        geoResults = geocoder.getFromLocationName("empire state building", 1);
    }
    if (geoResults.size()>0) 
    {
        point= new GeoPoint( (int) (geoResults.get(0).getLatitude() * 1E6), (int) (geoResults.get(0).getLongitude() * 1E6));
    }
    mapView = new MapView(this, "YOU-NO-GET-TO-SEE-MY-KEY-HERE!");


    MapController mapController = mapView.getController();

    mapController.animateTo(point);
    mapController.setZoom(15);


               myMainLinearLayout.addView(mapView);

…

I also make sure to call myMainLinearLayout.removeAllViews() on my overrided onPause(), as well as setting variables to null, just to make sure all things are getting cleaned up.

I have also tried to see if, before the mapView initialization, mapView == null — It Never Is.
Anyone have any ideas?

Thanks in advance.
-Ethan

——–EDIT:

Here is what I’m doing in my onPause method, in my MapActivity

@Override
public void onPause()
{//CLEANUP
    super.onPause();
    myMainLinearLayout.removeAllViews();
    myMainLinearLayout= null;
    mapView = null;
}

that’s the only method I am overriding besides onResume()

  • 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-07T07:47:46+00:00Added an answer on June 7, 2026 at 7:47 am

    This post should help:

    You are only allowed to have a single MapView in a MapActivity

    Summary: Do not destroy your previous MapView. Instantiate it once in onCreate, and modify it whenever you need to directly.

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

Sidebar

Related Questions

I'm trying create a bot which automatically likes Facebook posts. Using Mechanize I can
In android, I'm trying to create an simple activity allowing me to modify a
I am trying to create a floating ticker for my customer websites which will
I am trying to create a ValueProxy which holds some basic information about a
I am trying to create an application in Java which allows for generation of
We are trying to create/query information from a CF based on the following structure
I'm trying to create a Makefile that uses information from the path to create
So I'm trying to create canvas elements using the information passed back by The
I'm not looking to harvest information, I'm just trying to create a way to
Hello, i'm trying to take detailed information from the database, i create a simple

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.