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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:38:27+00:00 2026-06-07T06:38:27+00:00

i have an application made with tab host. i need to refresh my listview

  • 0

i have an application made with tab host.
i need to refresh my listview (the second tab) when clicked.
this view contain the db data, it’s obvious that it need to be always up to date (because in the entire app i make update,insert,delete,…
how can i?

this is the onCreate in the class called by the tab

    super.onCreate(savedInstanceState); 
    setContentView(R.layout.bookmarks); 
    final Database info=new Database(this); 
    final Timer t = new Timer(); 
    info.open(); 
    final Cursor data=info.getData(); 
    final ListView listView1 = (ListView) findViewById(R.id.list_mia); 
    String[] from = new String[] {"contenuto"};
    int[] to = new int[] { android.R.id.text1 };
    SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,android.R.layout.simple_list_item_1, data, from, to); 
    listView1.setAdapter(adapter);

and this is the tab class (the “incriminated class is bookmarks)

    super.onCreate(savedInstanceState);
    setContentView(R.layout.tabs);
    TabHost tabHost = getTabHost();
    // Tab per lettore
    TabSpec lettoretab = tabHost.newTabSpec("Lettore");
    lettoretab.setIndicator("Lettore", getResources().getDrawable(R.drawable.lettore));
    Intent lettoreIntent = new Intent(this, Lettore.class);
    lettoretab.setContent(lettoreIntent);
    // Tab per bookmarks
    TabSpec bookmarkstab = tabHost.newTabSpec("Bookmarks");
    bookmarkstab.setIndicator("Bookmarks", getResources().getDrawable(R.drawable.bookmarks));
    Intent bookmarksIntent = new Intent(this, Bookmarks.class);
    bookmarkstab.setContent(bookmarksIntent);
    // Tab per create
    TabSpec createtabs = tabHost.newTabSpec("Create");
    createtabs.setIndicator("Create", getResources().getDrawable(R.drawable.create));
    Intent createIntent = new Intent(this, Create.class);
    createtabs.setContent(createIntent);
    // Tab per feed
    TabSpec feedtabs = tabHost.newTabSpec("Feed");
    feedtabs.setIndicator("Feed", getResources().getDrawable(R.drawable.feed));
    Intent feedIntent = new Intent(this, Feeds.class);
    feedtabs.setContent(feedIntent);
    // Tab per actionmobileapp
    TabSpec actionmobileapptabs = tabHost.newTabSpec("App");
    actionmobileapptabs.setIndicator("App", getResources().getDrawable(R.drawable.actionmobileapp));
    Intent actionmobileappIntent = new Intent(this, Actionmobileapp.class);
    actionmobileapptabs.setContent(actionmobileappIntent);
    // Aggiungo i tabs
    tabHost.addTab(lettoretab);
    tabHost.addTab(bookmarkstab);
    tabHost.addTab(createtabs);
    tabHost.addTab(feedtabs);
    tabHost.addTab(actionmobileapptabs);

i’ve tried recalling the code in onResume but no success…

  • 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-07T06:38:29+00:00Added an answer on June 7, 2026 at 6:38 am
    TabHost tabHost = getTabHost();
                Intent intent = new Intent(this, c);
                intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                TabHost.TabSpec spec = tabHost.newTabSpec("tab" + labelId);
                View tabIndicator = LayoutInflater.from(this).inflate(
                        R.layout.tab_indicator, getTabWidget(), false);
                TextView title = (TextView) tabIndicator.findViewById(R.id.title);
                title.setText(labelId);
                ImageView icon = (ImageView) tabIndicator.findViewById(R.id.icon);
                icon.setImageResource(drawableId);
    
                spec.setIndicator(tabIndicator);
                spec.setContent(intent);
                tabHost.addTab(spec);
    

    add this in TabActivity class inside the addTab().

    Thanks….

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

Sidebar

Related Questions

I have this application I made on a utility based app. How would I
I have made an application for IPad in objective C. In this I am
I made a tab as a Facebook Application. This app was made over Codeigniter
I have made a Tabbar based application in that i have three tab. each
I have made a bottom tab bar in the application.What I want is that
I have an application made by using phonegap 1.5.0 and jquery mobile 1.1.0.... I
I've come across an intriguing problem. I have an application made of several assemblies.
i have a windows application made in VB.NET which maintains a database, and i
I have a web application made with Spring that runs on Tomcat. On the
i have made an application having entity framewrok. It is wpf application, now it

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.