I have a Listview content form TextView and Edittext, and I want to get the value from each Edittext in this Listview.
My problems are:
When the Listview is created, the focus is not on the first Edittext in Listview.
The second problem, is when I enter a value in Edittext and move list text down in screen the value in Edittext changed or removed, or the value moved to another Edittext on screen.
You can see image in this link
my code is
ArrayList<HashMap<String, String>> AllStudent ;
AllStudent = new ArrayList<HashMap<String, String>>();
for (int j=0; j<15; j++){
HashMap<String, String> map = new HashMap<String, String>();
// adding each child node to HashMap key => value
map.put("id"," " + j);
map.put("name", "A" + j );
// adding HashList to ArrayList
AllStudent.add(map);
}
listadapter = new SimpleAdapter(
sc_grade_group.this, AllStudent,
R.layout.list_item_graed, new String[] { "id","name" },
new int[] { R.id.list_itemGra_t1, R.id.list_itemGra_t2 });
setListAdapter(listadapter);
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/list_item_LinearLayout"
android:layout_width="fill_parent"
android:layout_height="60dp"
android:background="@drawable/custom_bg_1"
android:orientation="horizontal"
android:padding="2dp"
android:weightSum="1" >
<TextView
android:id="@+id/list_itemGra_t1"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:visibility="gone" />
<TextView
android:id="@+id/list_itemGra_t2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.6"
android:background="@drawable/custom_bg_2"
android:gravity="left|center_vertical"
android:paddingLeft="6dip"
android:paddingTop="6dip"
android:textColor="@color/black"
android:textSize="17sp"
android:textStyle="bold" />
<TextView
android:id="@+id/list_itemGra_t4"
android:layout_width="180dp"
android:layout_height="match_parent"
android:layout_weight="0.28"
android:background="@drawable/custom_bg_2"
android:gravity="left|center_vertical"
android:paddingLeft="6dip"
android:paddingTop="6dip"
android:textColor="@color/gold"
android:textSize="13sp"
android:textStyle="bold"
android:visibility="gone" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.33"
android:background="@color/cachecolor2"
android:gravity="center_vertical|center_horizontal"
android:weightSum="1" >
<EditText
android:id="@+id/list_itemGra_Degree"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:ems="10"
android:inputType="numberDecimal" >
<requestFocus />
</EditText>
</LinearLayout>
<TextView
android:id="@+id/list_itemGra_t3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.07"
android:background="@color/cachecolor2" >
</LinearLayout>
<TextView
android:id="@+id/list_itemGra_t5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone" />
</LinearLayout>