How Do We Read An Edited Edittext Field Value Inside A Listview Item Upon A Button Click?
Solution 1:
Try implementing editText.addOnTextChangedListener()
just like you set the OnClickListener for your button. On every text changed, store the changed string in some string variable and access the variable when you click the button.
Solution 2:
You should not reinflate you view again, this will create a new view and your findViewById will return a new View.
Your code with the correction:
box.button.setOnClickListener( newView.OnClickListener()
{
@OverridepublicvoidonClick(View v)
{
string_is = (EditText) box.findViewById(R.id.manage_Z);
value_is = newInteger( string_is.getText().toString() );
}
});
Solution 3:
box.button.setOnClickListener( newView.OnClickListener()
{
@OverridepublicvoidonClick(View v)
{
string_is = (EditText)box.findViewById(R.id.manage_Z);
value_is = newInteger( string_is.getText().toString() );
}
});
Above worked. But I ran into a strange issue. I can only read the editText value of the 2nd listView item. I have several items in the list and when I click the other buttons, they give the following error message:
W/IInputConnectionWrapper: requestCursorAnchorInfo on inactive InputConnection
W/IInputConnectionWrapper: getTextBeforeCursor on inactive InputConnection
E/RichInputConnection: Unable to connect to the editor to retrieve text.
D/RichInputConnection: Will try to retrieve text later.
Post a Comment for "How Do We Read An Edited Edittext Field Value Inside A Listview Item Upon A Button Click?"