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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:53:58+00:00 2026-05-15T13:53:58+00:00

I have a listview that’s populated by rows that get their data from a

  • 0

I have a listview that’s populated by rows that get their data from a web server. It all works totally fine except I want to have a refresh button to re-download the data. I’m getting the data through an asynctask (getting the data in doinbackground) and then setting the listadapter in onpostexecute. All I do to run the asynctask which should take care of everything is run

new PopulateListTask().execute();

However, in my optionsSelect method, creating a new asynctask just like I did in oncreate doesn’t do anything. It doesn’t even enter doInBackground. I’ve tried using listView.invalidate() and listView.invalidateViews(). Is there some special way I’m supposed to repopulate a listview?

My only guess is that since I’m using a custom adapter, my getView method is creating some kind of error, but that wouldn’t explain why it’s not even entering my asynctask’s doInBackground method. Thoughts?

Edit: Posting some code. This is a trimmed down version.

`

 private class PopulateListTask extends AsyncTask<Void, Void, ArrayList<Quote>>{

 @Override
 protected ArrayList<Quote> doInBackground(Void... params) {

quotes = Helper.getQuotes();

return quotes;

}

@Override
protected void onPostExecute(ArrayList<Quote> quotes){

setListAdapter(new QuoteAdapter(ctx,R.layout.quote_row,quotes));

}


}

private class QuoteAdapter extends ArrayAdapter<Quote>{

    ArrayList<Quote> items;
    int resource;

    public QuoteAdapter(Context context, int textViewResourceId, ArrayList<Quote> items){
        super(context, textViewResourceId, items);

 this.items = items;
 this.resource = textViewResourceId;




    }

    @Override
      public View getView(int position, View convertView, ViewGroup parent){

      View v = convertView;

       LayoutInflater vi = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            v = vi.inflate(resource,null);

        // do stuff with v

       return v;
 }



}


@Override
public boolean onOptionsItemSelected(MenuItem item) {

    switch (item.getItemId()){

    case(MENU_REFRESH):
        new PopulateListTask().execute();


 }

`

Ok hopefully this works, sorry I’m still not totally sure the best way to enter code.

Edit2:

I’m getting this in my logcat when executing my asynctask the 2nd time. Any idea what it means? I tried googling to no avail.

W/InputManagerService( 52): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@43b9dee8

  • 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-15T13:53:59+00:00Added an answer on May 15, 2026 at 1:53 pm

    The error was in creating my options subMenu. I had

    menu.addSubMenu( MENU_REFRESH, 0, 0, “Refresh”);

    isntead of

    menu.addSubMenu(0, MENU_REFRESH, 0, “Refresh”);

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

Sidebar

Related Questions

No related questions found

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.