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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:44:38+00:00 2026-06-09T16:44:38+00:00

So, my activity implements Runnable and within the run() method I do some web

  • 0

So, my activity implements Runnable and within the run() method I do some web scraping and blah blah blah. But that doesn’t have to do with my question. I want it to run some scraping then update the ListView with the results I get. Inside that run method I have this:

myAL.notifyDataSetChanged();

But it doesn’t seem to be updating my listView… This is my onCreate:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    loadingSiteDialog = new ProgressDialog(this);
    loadingSiteDialog.setCancelable(false);
    loadingSiteDialog.setMessage("Retrieving Data, Please Wait...");

    loadingSiteDialog.show();

    list = (ListView)findViewById(R.id.list);
    myAL = new AdapterList(this,R.layout.mainlistlayout);
    list.setAdapter(myAL);
    list.setOnItemClickListener(new OnItemClickListener(){
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int pos, long id) {

        }
    });
    loading = true;
    this.run();

}

Withing my arrayadapter class I use ArrayLists that I propagate within my run() method.
My Custom ArrayAdapter class:

public class AdapterList extends ArrayAdapter<String>{

    public AdapterList(Context context, int textViewResourceId) {
        super(context, textViewResourceId);
    }
    @Override
    public View getView(int pos, View convertView, ViewGroup parent){
        View v = convertView;
        if(v == null){
            LayoutInflater vi = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            v = vi.inflate(R.layout.mainlistlayout, null);
        }
        TextView roomTV = (TextView)findViewById(R.id.roomTV);
        roomTV.setText(rooms.get(pos));
        TextView wTV = (TextView)findViewById(R.id.washersTV);
        wTV.setText(washersAvailable.get(pos) + "/" + washersTotal.get(pos));
        TextView dTV = (TextView)findViewById(R.id.dryersTV);
        dTV.setText(dryersAvailable.get(pos) + "/" + dryersTotal.get(pos));
        Log.i("CSUMB Laundy","Attempting to getView: " + convertView.toString());
        return v;
    }

}

Am I just forgetting something? Its been a while since I have had to work with custom listviews.

  • 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-09T16:44:39+00:00Added an answer on June 9, 2026 at 4:44 pm

    Instead of

    TextView wTV = (TextView)findViewById(R.id.washersTV);
    

    Try

    TextView wTV = (TextView) v.findViewById(R.id.washersTV);
    

    Edit:

    I guess your listview is not updating because you never add data to your adapter.
    Change your adapter class construct method from,

    public AdapterList(Context context, int textViewResourceId) {
            super(context, textViewResourceId);
        }
    

    Like:

    private ArrayList<ListItem> listItems;
    
            public AdapterList(Context context, int textViewResourceId,
                    ArrayList<YourListItemClass> objects) {
                super(context, textViewResourceId, objects);
                listItems = objects;
                // TODO Auto-generated constructor stub
            }
    

    and get your data with only

    listItems.get(position);
    

    and set its contents to your views.

    Of course, you should define a class like ListItem and an ArrayList of this class to construct your adapter from this arraylist.
    When you stored your data in this arraylist, add it to your adapter.

    myAL.add(yourArrayList);
    

    and it will update your listview.

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

Sidebar

Related Questions

I have a Thread that downloads data from internet public class Bp implements Runnable
I have an activity that implements MediaController.MediaPlayerControl . The audio player plays the file
So I have my MainDisplayActivity which implements both Activity and LoaderManager.LoaderCallbacks<Cursor> . Here I
I have implemented a custom view within another activity into a XML layout. The
public class BabyName extends Activity implements View.OnClickListener, Runnable{ /** Called when the activity is
Inside public class IAmHere extends Activity implements LocationListener { i have @Override public void
I have following code: public class readSensorsData extends Activity implements SensorListener { /** Called
I have some shared preferences (latitude, longitude) that I want to access from a
I have an application that runs an activity with a service in a separate
I have a custom SurfaceView that looks like this: public class GFXSurface extends Activity

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.