Odd ListView bug
<p>I am implementing a form using a ListView. Each row in the ListView contains an EditText associated with a TextView that describes the input type, and is hence defined:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="horizontal"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"&gt;

    &lt;TextView android:id="@+id/textFormItem"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:textSize="16sp"
        android:ellipsize="end" android:singleLine="true" /&gt;

    &lt;EditText android:id="@+id/editFormItem"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:scrollHorizontally="true" /&gt;
&lt;/LinearLayout&gt;
</code></pre>

<p>I am implementing a custom Adapter that subclasses SimpleAdapter. So far, the code looks like this:</p>

<pre><code>public class FormAdapter extends SimpleAdapter {
    public static final String KEY = "key";

    static final String[] FROM = { KEY };
    static final int[] TO = { R.id.textFormItem };

    private static ICUApplication app;

    private FormAdapter(Context context, List&lt;? extends Map&lt;String, ?&gt;&gt; data) {
        super(context, data, R.layout.form_item, FROM, TO);

        setViewBinder(VIEW_BINDER);
    }

    public static FormAdapter createAdapter (Context ctx, Set&lt;String&gt; dataTypeSet) {
        List&lt;Map&lt;String,String&gt;&gt; data = 
                new ArrayList&lt;Map&lt;String,String&gt;&gt;(dataTypeSet.size());

        for (String dataType : dataTypeSet) {
            Map&lt;String,String&gt; map = new HashMap&lt;String,String&gt;();
            map.put(KEY, dataType);
            data.add(map);
        }

        app = (ICUApplication) ctx.getApplicationContext();

        return new FormAdapter(ctx, data);
    }

    static final SimpleAdapter.ViewBinder VIEW_BINDER = new SimpleAdapter.ViewBinder() {

        @Override
        public boolean setViewValue(View view, Object data,
                String textRepresentation) {
            int viewId = view.getId();
            switch (viewId){
            case R.id.textFormItem:
                String key = (String) data;
                ((TextView) view).setText(app.getTypeNameForKey(key));
            }

            return true;
        }
    };
}
</code></pre>

<p>Some notes: the reason I implemented the view binder is that I want the ListView to display the user-friendly name for a data type (as given by <code>app.getTypeNameForKey(key)</code>) while storing each row internally by its <code>KEY</code>. Also, the Activity that uses these two classes, at the moment, only has code that sets a ListView to use this adapter.</p>

<p>Earlier, it was harder to figure out exactly what was happening because of EditText focus issues, which I solved using a question asked here earlier: <a href="http://stackoverflow.com/questions/2679948/focusable-edittext-inside-listview">Focusable EditText inside ListView</a>. Currently, I have three items in the form. So, here is the odd bug:</p>

<ul>
<li>If I tap the first EditText, the on-screen keyboard opens and focus shifts to the third EditText. Anything I type into this third EditText will then get moved back to the first EditText after I close the keyboard.</li>
<li>If I tap the second EditText, the keyboard opens and focus again shifts to the third EditText. Anything I type into this third box will get moved, not to the second EditText, but the first one again.</li>
<li>If I tap the third EditText, focus doesn't shift, but after closing the keyboard, the input gets moved to the first EditText.</li>
<li>And a whole host of other odd issues related to the above three that I won't list here because it would make this already long question excessively long.</li>
</ul>

<p>Any ideas as to why this is happening and how I can fix it?</p>
