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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:54:02+00:00 2026-05-31T03:54:02+00:00

I am having an Activity where I am having a ListView , but on

  • 0

I am having an Activity where I am having a ListView, but on click of a Button, I want to replace the ListView with a MapView.
I’ve some options to do this, like having MapView loaded in the Layout already, but setting it’s visibility to View.GONE and make it visible only when the user clicks on the button.
Another option would be to use a removeView() and addView(), however I can’t do this as the Layout is LinearLayout and the View should be added in middle of it.(Don’t know if there’s any method to do it).
Last option is to use ViewStub, however I’ve never used it before.

Which of the above option is best performance-wise and why? Considering the user can switch between ListView and MapView multiple times.

Edit: Forgot to mention ViewSwitcher, never used it before too.

  • 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-31T03:54:03+00:00Added an answer on May 31, 2026 at 3:54 am

    After searching a lot, I’ve come to know these things –
    Adding and removing Views would be too bad and prone to crashes.
    Setting Visibility is a good option, however, the performance doesn’t improve.
    Using ViewStub is better solution, as the initial loading time is reduced.
    Using ViewFlipper is also very easy to use solution. It’s so easy that I ended up using ViewFlipper in my application and there’s no major impact on performance.(Main reason was it’s easy to added animation in it)

    I am trying to use ViewStub in ViewFlipper. I’ll let you know when I’ll be successful in doing it.

    PS: The question is still open to answers. Let me know if I made any mistake here.

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

Sidebar

Related Questions

I want a layout such that user can toggle between listview and mapview and
I want my whole activity to scroll at once, but the ListView which is
I am having a problem in searching a ListView. In my activity I have
I have an activity with three listviews, each having three different cursors, but all
im fairly new to android development, but i'm having some trouble trying to make
I am developing Android Application having the listview in an activity . I implemented
I am having an Activity in which I am having some View that is
I am having some serious trouble with getView in a ListView. The problem is,
I have a layout having the contact deatils of the phone. When i click
I am having some problems with an alertdialog box. I have a listview containing

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.