Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to correctly handle Android EditText input inside a ListView?
    primarykey
    data
    text
    <p>In my application I have an activity to add/remove/edit records inside a <code>SortedMap</code>. The activity is implemented as an extension of <code>ListActivity</code>. I have implemented custom <code>ArrayAdapter</code> for the collection items.</p> <p>Every <code>ListView</code> item (which corresponds to an underlying record) consists of <code>TextView</code>s, <code>EditText</code>s, and a <code>Button</code> to delete the record itself. The layout is roughly as follows:</p> <pre><code>ListView ---------------------------------------------------- [TextView] [EditText] [TextView] [EditText] [Button] ---------------------------------------------------- [TextView] [EditText] [TextView] [EditText] [Button] </code></pre> <p>My goal is to process the input a user types to the <code>EditText</code>s as soon as the user finished editing, i.e. when the user has navigate away from the <code>EditText</code> or the user has pressed back to dismiss the onscreen keyboard. </p> <p>I have tried implementing this by handling <code>onFocusChanged</code>, to process the text visible in the <code>EditText</code>. However this method is not working well, <code>onFocusChanged</code> method is called very often and randomly, even for unselected &amp; unedited <code>EditText</code>s. This is probably due to <a href="http://android-developers.blogspot.com/2009/04/updating-applications-for-on-screen.html" rel="nofollow noreferrer">this article on Android Blog</a> from this <a href="https://stackoverflow.com/questions/2825571/android-edittext-in-listview">StackOverflow question</a>.</p> <p>Is there a better way to do this?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload