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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:21:32+00:00 2026-05-28T07:21:32+00:00

I have a ListView that is filled with items of an ArrayAdapter. Now I

  • 0

I have a ListView that is filled with items of an ArrayAdapter.
Now I want to strike them out when click and also check in the beginning if they are already struck through(calling an external api etc).
But it only works in the onItemClickListener the method above it doesn’t.
to understand it better, here is some code:

public void machListe() { 
   listViewArrayAdapter = new ArrayAdapter(getApplicationContext(),R.layout.task_item, ti);
   taskListe.setAdapter(listViewArrayAdapter);
   TextView ab=(TextView) taskListe.getChildAt(0);

So if I Debugg now I see that ab is null.

taskListe.setOnItemClickListener(new OnItemClickListener() { 

   public void onItemClick(AdapterView<?> arg0, View arg1,int arg2, long arg3) {

     TextView ab=(TextView) taskListe.getChildAt(0);

If I debug here, ab is NOT null.

  • 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-28T07:21:33+00:00Added an answer on May 28, 2026 at 7:21 am

    You are trying to saft the state of the tasks inside your Views.

    You should try to separate Model and View at this point.
    Create a Model Object that contains a single task then extend ArrayAdapter and overwrite getView. In the getView you retrieve the correct task from the task list. Create the textview for the task and if the task is marked as done in your model you cancel out the text.

    If you try to change the views in a list after they are created you would have to do this every time the list stops scrolling because the list will only hold childviews for the items that are shown on the screen, the other views are created during scrolling to save memory.

    The only correct place to change a listview Item is in the getView method of the corresponding Adapter.

    Have a look at the ListsView Tutorial on vogella.de for more information.

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

Sidebar

Related Questions

A have a ListView that is rendered with multiple items. Now I want to
I have a listview (in Details view) that is filled dynamically. I want to
I have a ListView that I am populating with items from an ObservableCollection .
I have a ListView that is populated using an XML file. However, I want
I have a ListView that contains 3 checkboxes per row. I want to set
I have a ListView that is filled by an ObservableCollection<MenuTrayItem> . In my resources
I have a 2X2 Grid that is filled with 2 Listview controls and some
I have a ListView that displays sales orders, and groups them by status. In
I have a sortable listview that gets filled with a live data as it
I have a listview that I want to add event listener to it. The

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.