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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:51:13+00:00 2026-05-22T00:51:13+00:00

I have to tabs, new and REPORTS. In the REPORTS tab, I’m creating a

  • 0

I have to tabs, new and REPORTS. In the REPORTS tab, I’m creating a listview that is created dynamically. Now listview list items are being fetched from the database. So every time the REPORTS tab is loaded, the listview list items have to be fetched from the database in case there has been a change in the list items. If I put all this stuff in the onCreate of REPORTS tab, everything works perfectly. But if I switch to another tab and switch back to REPORTS tab, the listview is populated but the change made in the database in the list items is not reflected. Whenever I come back to the REPORTS tab, I need to get the current data from the database and display in the listview.

So the problem is since I’m doing the populating of the listview in onCreate, this is happening only once. After looking around online, I found the TabContentFactory() stuff. Well, I thought this would solve my problem. This is what I did,

TabHost.TabSpec reportsSpec = tabHost.newTabSpec("reports").setIndicator("Reports")
    .setContent(new TabHost.TabContentFactory(){
        public View createTabContent(String tag) {
            Context context = Main_screen.this;
            ls1 = new ListView(Main_screen.this); 
            //populate m_data from the database

            CustomAdapter adapter =  new CustomAdapter(context, m_data);
            ls1.setAdapter(adapter);    
            return ls1;}});
tabHost.addTab(reportsSpec);

But this doesn’t solve my problem. It looks like the code inside createTabContent is executed only when the tab is created and not every time I switch to the REPORTS tab.

Can this be done at all? Can we create the content of a tab every time we switch to the tab?
Please help. Any help is greatly appreciated.

  • 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-22T00:51:14+00:00Added an answer on May 22, 2026 at 12:51 am

    In the tabview, try putting the data load into the onResume method.

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

Sidebar

Related Questions

I have some tabs created with jQuery UI After I create a new tab
I have an add button for adding new tabs. The tab list is also
I have 3 tabs, created by js. Active tab has class named active and
I have a tabs as views in my activity. Each tab represents a ListView
I have some tabs created with jquery and i want to add new tabs.
I have created a custom list input form based on the default New.aspx template.
I have a simple Chrome extension that opens new Chrome tabs on clicking some
I have been looking into packages that would enable me to have tabs in
I have created tabs by using jQuery API and have bound one event handler
I have three tabs. When I press the tab button on the bottom, is

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.