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

  • Home
  • SEARCH
  • 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 6578907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:49:52+00:00 2026-05-25T15:49:52+00:00

I need some help with threading in my app. Ive got an activity that

  • 0

I need some help with threading in my app. Ive got an activity that has a listview. Each listview item has one button and one textview. I would like to have each button click run in its own thread and update the corrosponding textview control on its row.

Im a beginner android developer and would appreciate some input on this. Ive tried to implament an AsyncTask sub class, but cant figure out how to do it for each button and have it update the textview.

Thanks!

  • 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-25T15:49:53+00:00Added an answer on May 25, 2026 at 3:49 pm

    you have to call the new Instance of the same AsyncTask every time you perform a click on the item.

        OnItemClickListener itemListener = new OnItemClickListener() {
    
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position,
        long arg3) {
                asyncTaskName newTask = new AsyncTaskName(view , position);
                newTask.execute();
         }
       }
    

    view and position are part of constructor because you would like to update the item ,that is what view is for, and position is to do something unique based on position in your asyncTask.

    In your asyncTask , you might have to something similar to what i have done below.

     private class asyncTaskName extends AsyncTask<Void, Void, Void> {
            private View mView;
            private int mPosition;
    
          public asyncTaskName(View view, int position){
              mView = view;
              mPosition = position;
          }
    
    
         protected void doInBackground(Void... urls) {
             // do something you have to here based on mPosition.
             return null;
         }
    
         protected void onPostExecute(Void result) {
             // now update the textView here
             TextView tv = (TextView) mView.findViewById(yourTextViewId);
             // now you have reference to tv, probably update the text by
             tv.setText(yourString);
         }
     }
    

    HTH.

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

Sidebar

Related Questions

Need some help, please. I have a line of horizontal thumbnails loaded as ONE
Need some help from javascript gurus. I have one page where http://www.google.com/finance/converter is embedded
Need some help assigning a mouseover event to display some icons that start out
Need some help, I have a regular expression that appears to work just fine
need some help! I'm trying to write some code in objective-c that requires part-of-speech
I need some more help. I am a noob at threading and I am
I need some help implementing threading using Python 2.1. I would readily update to
I've a multi-threading application in which each thread has to do some job, but
Need some help about with Memcache. I have created a class and want to
Need some help to solve this. I have a gridview and inside the gridview

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.