Skip to content Skip to sidebar Skip to footer

I Have A Listview, Where Each Row Contains An Edittext Field And Textview, What Ever I Typed In The Edittext I Want To See In The Textview?

Here i have the following code below :- public class OrderActivity extends ListActivity implements OnClickListener{ ArrayList data,rate, num; OrderAdapter orderAdapt

Solution 1:

hi you can use the code below to do this,

for source: https://dl.dropbox.com/u/68130108/ListViewEditItem.rar

publicclassOrderActivityextendsListActivityimplementsOnClickListener{
// create static object to hold your widget in listviewstatic TextView sTxt;
static EditText sEdTxt;
staticint p;

.
.
.
.


etQty.setId(position);
etQty.setTag(tvRate);           
etQty.setOnFocusChangeListener(newOnFocusChangeListener() {

publicvoidonFocusChange(View v, boolean hasFocus) {
    sPosition = v.getId();
    sTxt = (TextView) v.getTag();
    EditTexte= ((EditText) v);
    if (!e.getText().toString().equals("")) {
        if (hasFocus) {
                // change your num arraylist values at the position// because you can’t save anything on ListView Item.
            num.set(sPosition,e.getText().toString());                          
        }                       
    }
}
});

editText.addTextChangedListener(newTextWatcher() {
   @OverridepublicvoidonTextChanged(CharSequence s, int start,int before, int count) {}
   @OverridepublicvoidbeforeTextChanged(CharSequence s, int start,int count, int after) { }
   @OverridepublicvoidafterTextChanged(Editable s) {
       // every text change setText of textview 
       sTxt.setText(s);
   }
});

tvRate.setText(num.get(position));
.
.
.
.

enter image description here

Post a Comment for "I Have A Listview, Where Each Row Contains An Edittext Field And Textview, What Ever I Typed In The Edittext I Want To See In The Textview?"