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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:37:59+00:00 2026-06-11T05:37:59+00:00

I need to build BaseExpandableListAdapters using lists of data from the server. I am

  • 0

I need to build BaseExpandableListAdapters using lists of data from the server. I am using an AsyncTask to retreive this list of values. As I cannot currently return a BaseExpandableListAdapter from the DoInBackGround override method, I am using public properties. With below code I can either:

  1. Get the My and Market properties of my AsyncTask class to return with all expected values BUT my ProgressDialog doesn’t appear until after the task is executed rendering it useless, OR
  2. Get the ProgressDialog to show up immediately as desired BUT the My and Market properties are empty when I try to use them to assign adapters to my listviews

I need to achieve both.

public class Work : Activity
{
    private ExpandableListView market;
    private ExpandableListView my;

    protected override void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle);

        SetContentView(Resource.Layout.Work);

        market = (ExpandableListView)FindViewById(Resource.Id.market);
        my = (ExpandableListView)FindViewById(Resource.Id.my);

        PopulateWorkListViews populate = new PopulateWorkListViews(this);
        populate.Execute(techID, market, userType);

        //Removing the following line allows for the ProgressDialog but the Market 
        //and My properties of the PopulateWorkListViews class are empty as opposed 
        //to leaving this line in and both properties contain all expected values 
        //but ProgressDialog doesn't show up.
        string result = populate.Get().ToString();

        market.SetAdapter(populate.Market);
        my.SetAdapter(populate.My);
    }
}

public class PopulateWorkListViews : AsyncTask
{
    private Context Context { get; set; }
    private ProgressDialog Dialog { get; set; }
    public BaseExpandableListAdapter Market { get; set; }
    public BaseExpandableListAdapter My { get; set; }

    public PopulateWorkListViews(Context context)
    {
        Context = context;
    }

    protected override void OnPreExecute()
    {
        Dialog = new ProgressDialog(Context);
        Dialog.SetMessage("Processing...");
        Dialog.Window.SetGravity(GravityFlags.Center);
        Dialog.SetCancelable(false);
        Dialog.Indeterminate = true;
        Dialog.SetProgressStyle(ProgressDialogStyle.Spinner);
        Dialog.Show();
    }

    protected override Java.Lang.Object DoInBackground(params Java.Lang.Object[] @params)
    {
        WS ws = new WS();
        List<ServiceCall> calls = ws.GetMarketCalls(@params[0].ToString(), @params[1].ToString(), @params[2].ToString()).ToList();

        Market = new MarketCallListView(Context, calls);
        My = new MyCallListView(Context, calls, @params[0].ToString());

        return "Done";
    }

    protected override void OnPostExecute(Java.Lang.Object result)
    {
        Dialog.Dismiss();
    }
}
  • 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-11T05:38:00+00:00Added an answer on June 11, 2026 at 5:38 am

    The reason the dialog isn’t being drawn immediately is that you’re blocking the UI thread in populate.Get(). What if you move the two SetAdapter lines at the bottom of onCreate to onPostExecute?

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

Sidebar

Related Questions

I need to build a Data Warehouse for an existing SQL Server database. I
I need to build a reporting system that would pull the data from a
This I'm trying for transfer my current Apache/Modperl site to Starman, and need build
I need to build app with user messages (dialogs). I've solved this problem by
I need to build some client side code which follows this use case: An
I need to build a multidimensional array from records retrieved from my database. Here
I need to build Java Swing Desktop Application in which JPEGs from a particular
I need to build a window designed to look exactly like this (it has
I need to build a XML file of my SQL table. This is my
I need to build a drop down list dynamically, whereby after entering particular text

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.