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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:26:37+00:00 2026-06-11T04:26:37+00:00

I need develop next situation: i have main_screen.xml with TabHost, wich have two (or

  • 0

I need develop next situation: i have main_screen.xml with TabHost, wich have two (or more) Tabs – each of them have as root element ViewPager.

ViewPager have two (or more) pages next sequence MainViewList->DetailView->MapView and go back MapView->DetailView->MainViewList (M->D->M)

There i have problem: on the first pass all works fine, but after again M->D->M it’s crashes with exception than Only One MapView can be inflated with MapActivity.

I check with debug that method destroyItem on ViewPagerAdapter works corects – it’s remove MapView from parentView (ViewPager).

Also then i go Map->D->M i remove from list of screens in ViewPagerAdapter prevscreen – so i can’t return to screen if slide to left (first screen, or DetailView after MapView,i can’t slide back to MapView – i need this logic works).

Also you can see this post MapView not being removed from ViewPager? with same problem.

  • 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-11T04:26:38+00:00Added an answer on June 11, 2026 at 4:26 am

    So i have found next solution

    ViewPager is part of any Activtiy, so i create activity next code

    class FirstTabActivityWithMap extends MapActivity{
     MapViewHolder mpViewHolder;//Extends ViewHolder and contains MapView inflated from layout resource
    
    protected void onCreate(...){
    // Create view pager
     myViewPager=new ViewPager();//And etc init Pager
    
    //Some code witch create mpViewHolder - it's depend of yours needs
     setContentView(myViewPager);
    }
    
    //Here is magic :)
    public void someActionWichNeedAddScreenWithMap(){
    
     //Remove current map from prev parent 
     if (mpViewHolder.currentView.getParent() != null) {
        ((ViewPager) mpViewHolder.currentView.getParent())
            .removeView(mpViewHolder.currentView);
        }
        this.myViewPager.addScreen(mpViewHolder);//Adding screen and call notifyDataSetChanged()
     }
    
    }
    

    This code ((ViewPager) mpViewHolder.currentView.getParent()).removeView(mpViewHolder.currentView);
    have one problem – it’s you always will work with same MapView instance.

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

Sidebar

Related Questions

I need to develop a module which will execute scheduled tasks. Each task is
Pretty soon now, we're gonna need to develop a GUI for creating configurations (more
I need to develop an app that is using multithreading. Basicly, I have a
I need to develop an application on Android platform that enables a client to
I need to develop a service that will perform login through several login providers
I need to develop a winform with a treeview menu, localizable and with different
I need to develop a Lotus Notes plug-in that adds some UI to Lotus
I need to develop a easy web site, I usually use bootstrap CSS framework,
I need to develop a classic asp application on vista, and would like to
I need to develop some sort of application featuring Editing Movie slices, Adding and

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.