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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:08:20+00:00 2026-05-29T05:08:20+00:00

Given my xml file below, I want to show the ListView when my object

  • 0

Given my xml file below, I want to show the ListView when my object list is not empty and I want to show the ViewStub when my list is empty. I can get this to work, but whenever I change screen orientations, I lose the new data that I’ve added to my list.

Basically, any time I add a new object, I call my adapter’s changeData() method which changes the object list and calls the method notifyDataSetChanged(). Any advice on how to make sure this change persists across all views?

(There’s more in the XML but it’s irrelevant):

    <ListView android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:layout_weight="1"
        android:id="@android:id/list"></ListView>

    <ViewStub android:id="@android:id/empty"
        android:layout_width="wrap_content" android:layout_height="wrap_content"
        android:layout_gravity="center" android:layout="@layout/empty" />

</FrameLayout>
  • 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-29T05:08:21+00:00Added an answer on May 29, 2026 at 5:08 am

    You have to maintain your screen state by using the savedInstanceState Bundle which is available in the onCreate() method.
    Every time when you change your screen orientation onCreate() is called.

    here an example : [CLICK]

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

Sidebar

Related Questions

I have a given XML document (structure can not be changed) and want to
Say I have this given XML file: <root> <node>x</node> <node>y</node> <node>a</node> </root> And I
Given this example XML file: <doc> <tag> Hello ! </tag> <tag> My name is
I want to create a list out of an xml file where only values
I have a file list as given below which is used by an existing
The XML file I want to extract data from looks as below: `<groups> <group>approved</group>
I created a state-list selector file item_bg_selector.xml in the drawable folder like this :
My categories.xml file is given below <categories> <root name=Cars -Vehicles id=CV></root> <root name=Personals id=PER></root>
I was given an .xml file that I needed to read into my code
I am given a task to convert a huge table to custom XML file.

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.