Get The Value Of Dynamically Generated Multiple Edittext Using Gettext In Android
i want the text value set on multiple edittext, onclick of button .Edit text is generated dynamically and i want value of each particular edit text.and store that value of text in
Solution 1:
Change it to
tv_edittext = new MyTextView(this);
where MyTextView is :
publicclassMyTextViewextendsTextView{
publicSampleEditText(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
// TODO Auto-generated constructor stubthis.addTextChangedListener(newMyTextWatcher());
}
publicSampleEditText(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stubthis.addTextChangedListener(newMyTextWatcher());
}
publicSampleEditText(Context context) {
super(context);
// TODO Auto-generated constructor stubthis.addTextChangedListener(newMyTextWatcher());
}
}
Use a textwatcher as follows:
publicclassMyTextWatcherimplementsTextWatcher {
}
No matter how many textviews you dynamically create, a watcher will be created for it and you can get the text being typed in the onTextChanged
method of the textwatcher.
Post a Comment for "Get The Value Of Dynamically Generated Multiple Edittext Using Gettext In Android"