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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:08:25+00:00 2026-05-28T11:08:25+00:00

I have list item with EditText in it, I dont know how many items

  • 0

I have list item with EditText in it, I dont know how many items there will be.
I have a problem when I enter some text in EditText, and then scroll down a ListView, after I’ve scroll up again there is no text in my first EditText, or there is some text from other EditText from ListView.

I’ve tried TextWatcher, and saving data to array, but problems is that returned position of view in ListView isnt always right, so I lost some data from array. -.-

How to detect correct position of view in ListView?

For example:

If I have 10 items in ListView, and only 5 of them are currently visible.
Adapter return position from 0 to 4…thats ok.
When I scroll down position of item 6 is 0…wtf? and i lose data from array on position 0 🙂

Im using ArrayAdapter.

Please help.

Here’s some code:

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

    tmp_position = position;

    if (convertView == null) {

        holder = new ViewHolder();

        LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = vi.inflate(R.layout.element_in_game, null);

        holder.scoreToUpdate = (EditText) convertView
                .findViewById(R.id.elementUpdateScore);

        holder.scoreToUpdate.addTextChangedListener(new TextWatcher() {

            @Override
            public void onTextChanged(CharSequence s, int start,
                    int before, int count) {
                scoresToUpdate[tmp_position] = s.toString();
            }

            @Override
            public void beforeTextChanged(CharSequence s, int start,
                    int count, int after) {

            }

            @Override
            public void afterTextChanged(Editable s) {

            }
        });

        initScoresToUpdateEditTexts(holder.scoreToUpdate, hint);

        convertView.setTag(holder);

    } else {

        holder = (ViewHolder) convertView.getTag();

        holder.scoreToUpdate.setText(scoresToUpdate[tmp_position]);

    }

    return convertView;
}
  • 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-28T11:08:26+00:00Added an answer on May 28, 2026 at 11:08 am

    you should try in this way as below:

    if (convertView == null) {
    
            holder = new ViewHolder();
    
            LayoutInflater vi = (LayoutInflater)    
            getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            convertView = vi.inflate(R.layout.element_in_game, null);
    
            holder.scoreToUpdate = (EditText) convertView
                    .findViewById(R.id.elementUpdateScore);
    
    
            convertView.setTag(holder);
    
        } else {
    
            holder = (ViewHolder) convertView.getTag();
    
        }
       //binding data from array list
       holder.scoreToUpdate.setText(scoresToUpdate[position]);
       holder.scoreToUpdate.addTextChangedListener(new TextWatcher() {
    
                @Override
                public void onTextChanged(CharSequence s, int start,
                        int before, int count) {
                    //setting data to array, when changed
                    scoresToUpdate[position] = s.toString();
                }
    
                @Override
                public void beforeTextChanged(CharSequence s, int start,
                        int count, int after) {
    
                }
    
                @Override
                public void afterTextChanged(Editable s) {
    
                }
            });
    
        return convertView;
    }
    

    Explanation:
    Recycling behavior of ListView, actually erase all data bind with its Row Item, when go out of vision.
    So every new row coming in in vision from whatever direction you need to bind data again.
    Also, when EditText text change you have to keep values also in some data structure, so later on again row data binding you can extract data for position.
    You can use, array ArrayList for keeping edittext data, and also can use to bind data.

    Similar behavior use in Recyclerview Adapter, behind logic you need to know about data binding of row data of adapters.

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

Sidebar

Related Questions

I have list item with EditText in it, I don't know how many items
I have some code that inserts a list item into a list... I then
I have a list of items. When I create the list each item has
I have a list, and each item is linked, is there a way I
I have a long scrolling list of EditText items created by a SimpleCursorAdapter and
I have a list containing 98 items. But each item contains 0, 1, 2,
I have a list item with buttons in it like so: <mx:List contentBackgroundAlpha=0 baseColor=0x333333
I have a list of 2-item tuples and I'd like to convert them to
I have a list of two-item lists and need to search for things in
Hopefully this is simple: I have a relatively long list where each list item

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.