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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T12:03:02+00:00 2026-06-11T12:03:02+00:00

I am trying to create a tabbar and specs in it , but the

  • 0

I am trying to create a tabbar and specs in it , but the thing is I need to do it in an asycn task so its without TabActivity. After running this code below I only see my main layout. And in the end what Im trying to do is, I wanna show a progress bar to the user which say the necessary files are getting copied just for the first time once application is installed, in the mean time copy files then create tabHost and add specs. Without an asyncTask it works quite good but for the first time application runs the screen gets locked for 20 or 30 seconds till the copying process get done. Any idea ? Thanks in advance.

public class AsyncTest extends AsyncTask<Void, Void, Void> {

Context context;
DataBaseJSONFunctions json;

TabHost tabHost;

TabWidget tabWidget;

Resources res;

TabHost.TabSpec sp;

Intent intent;

ProgressDialog dialog;

Activity ac;

public AsyncTest(Context context, TabHost tabHost, TabHost.TabSpec sp, Bundle savedInstanceState) {
    this.context = context;
    json = new DataBaseJSONFunctions(context);
    this.tabHost = tabHost;
    tabWidget = tabHost.getTabWidget();
    this.sp = sp;
    ac = (Activity) context;
    res = context.getResources();

    LocalActivityManager mlam = new LocalActivityManager(ac, false);
    mlam.dispatchCreate(savedInstanceState);
    tabHost.setup(mlam );

}

@Override
protected Void doInBackground(Void... params) {
    initializeAll();
    return null;
}

@Override
protected void onPostExecute(Void result) {

    dialog.dismiss();

    // to go through to the another activity in the tab I need to initialize an intent.
    // and I need to set the Tab bar and it's icon.
    intent = new Intent().setClass(ac, Activities.class);
    sp = tabHost.newTabSpec("activities").setIndicator("activities",res.getDrawable(R.drawable.tab_activities_selector)).setContent(intent);
    tabHost.addTab(sp);

    // doing the same things for Songs Activity.
    intent = new Intent().setClass(ac, Promotions.class);
    sp = tabHost.newTabSpec("promotions").setIndicator("promotions",res.getDrawable(R.drawable.tab_promotions_selector)).setContent(intent);
    tabHost.addTab(sp);


    // doing the same things for another Activity.
    intent = new Intent().setClass(ac,Menu.class);
    sp = tabHost.newTabSpec("menu").setIndicator("Menu",res.getDrawable(R.drawable.tab_menu_selector)).setContent(intent);
    tabHost.addTab(sp);


    intent = new Intent().setClass(ac, Gallery.class);
    sp = tabHost.newTabSpec("gallery").setIndicator("Gallery",res.getDrawable(R.drawable.tab_gallery_selector)).setContent(intent);
    tabHost.addTab(sp);


    intent = new Intent().setClass(ac, Info.class);
    sp = tabHost.newTabSpec("info").setIndicator("Info",res.getDrawable(R.drawable.tab_info_selector)).setContent(intent);
    tabHost.addTab(sp);

    for(int i = 0; i < tabWidget.getChildCount(); i++){
        tabWidget.getChildAt(i).setBackgroundResource(R.drawable.tab_bar);
    }

    tabHost.setCurrentTab(0);

    // Starting location listener service.
    ac.startService(new Intent(ac, LocationService.class));

    ac.setContentView(R.layout.tabbar_main);
    super.onPostExecute(result);
}

@Override
protected void onPreExecute() {
    dialog = ProgressDialog.show(context, "", "Copying files please wait...");
    super.onPreExecute();
}
  • 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-11T12:03:03+00:00Added an answer on June 11, 2026 at 12:03 pm

    I have found the way to do it, I have an image view which has visibility as GONE and In the onPreExecute() I’m setting the visibility of this image as VISIBLE. and Also onPostExecute() I’m making it GONE as like before.

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

Sidebar

Related Questions

Trying to create a black line in my view to separate text blocks but
Trying to create a new Dedicated Cache Role in Windows Azure but get the
Trying to create a background-image slideshow and am getting this error... This is the
I'm trying create a RCP Application with Eclipse, but I can't get past the
I'm trying create this function such that if any key besides any of the
I trying create empty white image with php, this s my code $bg =
I am trying to create a settings page for an app, this app require
I'm trying create simple application in C++. This application has to read from file
I'm trying create a simple background periodic task using Django-Celery-RabbitMQ combination. I installed Django
I've been trying create this simple ish to-do list web app using JavaScript &

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.