prevent Custom ListView Refreshing on scroll. I want to stop refreshing

I am using Custom ListView in My Android App. The Problem is when i am scrolling ListView, it automatically clears entered data from EditText( Edittext as a list_item ) and it ListView refreshed. I Want to Prevent it to stop clearing entered data on ListView Scroll. Please Help me..


1) define custom list adapter

2) define a an object for each item like class MyClass { String myText}

3) store the value of the EditText of each item in that object

I have a code for storing the state of CheckBox. use and customize it for EditText.

protected interface MyTextWatcher extends TextWatcher { public void setEnabled(EditText editText, boolean enable); public void setText(EditText editText, String text); } private MyTextWatcher generalTextWatcher = new MyTextWatcher() { private boolean enabled_edtQty = true; private boolean enabled_edtPackingQty = true; public void setEnabled(EditText editText, boolean enable) { if (editText.equals(edtQty)) { this.enabled_edtQty = enable; } else if (editText.equals(edtPackingQty)) { this.enabled_edtPackingQty = enable; } } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { if (this.enabled_edtQty && edtQty != null && edtQty.getText().hashCode() == s.hashCode()) { edtQty_onTextChanged(s, start, before, count); } else if (this.enabled_edtPackingQty && edtPackingQty != null && edtPackingQty.getText().hashCode() == s.hashCode()) { edtPackingQty_onTextChanged(s, start, before, count); } } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { } @Override public void setText(EditText editText, String text) { this.setEnabled(editText, false); editText.setText(text); this.setEnabled(editText, true); } }; @Override public View getView(int position, View convertView, ViewGroup parent) { View rowView; final MyClass item = getItem(position); edtQty.addTextChangedListener(generalTextWatcher); edtPackingQty.addTextChangedListener(generalTextWatcher); generalTextWatcher.setText(edtQty, item.myText1); generalTextWatcher.setText(edtPackingQty, item.myText2); } protected void edtQty_onTextChanged(CharSequence s, int start, int before, int count) { item.myText1 = s; } protected void edtPackingQty_onTextChanged(CharSequence s, int start, int before, int count) { item.myText2 = s; }

in your situation you should use addTextChangedListener instead of setOnCheckedChangeListener


the answer by breceivemail is correct,

you can also try using ArrayList for storing data onTextChangeListener can store data when needed and you can restore data in getView of your listview's adapter

Note: if you are searching for stopping the listview from refreshing on scrolling, then you are going in wrong direction, because we can't stop listview from refreshing its contents(because all off screen contents are dumped in listviews), adapters are made to store/provide data when needed by listview(you can't rely on system to protect/store data you should store/restore data manually).


  • Custom TextView with just one character that was entered last from keyboard
  • implementing getFilter(). into custom ArrayAdapter with AsyncTask
  • gives Exception in set the value of EditText
  • EditText decimal mask for android
  • how to handle with addTextChangedListener and memory
  • EditText soft numeric keyboard sometimes does not allow digits
  • Custom Scroll Bar for Div with pure CSS [duplicate]
  • Quote original message in a reply using mailkit
  • Customize google placepicker colors for android
  • Visual Studio 2017 ASP.Net Publish Self-Contained Dot Net Core App
  • Resizing ToolStripButtons to fit complete BackGround image
  • Why are “sc.addFile” and “spark-submit --files” not distributing a local file to all workers?
  • Comparing user's facebook/twitter friends to site's users in Python/Django
  • Why can't UI components be accessed from a backgroundworker?
  • drawing random circles, storing their coorindates in an array
  • Autofac with Web API 2 - Parameter-less constructor error
  • Laravel: Getting Session ID oddly truncates when using foreach
  • How to disable all widgets inside Panel or inside Composite?
  • Bypass multiple inheritance in Java
  • Firefox Extension - Monitor refresh and change of tab
  • how to avoid repetitive constructor in children
  • Highlight and Bold text in JTextPane
  • Recording logins for password protected directories
  • how to do an event when i swipe from fragment to the other
  • C# - Serializing and deserializing static member
  • Akka Routing: Reply's send to router ends up as dead letters
  • Compare two NSDates in iPhone
  • Transpose CSV data with awk (pivot transformation)
  • Cannot Parse HTML Data Using Android / JSOUP
  • Use group_by to filter specific cases while keeping NAs
  • log4net write single file for each call to log.info
  • Benchmarking RAM performance - UWP and C#
  • Acquiring multiple attributes from .xml file in c#
  • JTable with a ScrollPane misbehaving
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • How can I remove ASP.NET Designer.cs files?
  • unknown Exception android
  • failed to connect to specific WiFi in android programmatically
  • java string with new operator and a literal
  • How can I use threading to 'tick' a timer to be accessed by other threads?