在android中使用gettext获取动态生成的多个edittext的值

在android中使用gettext获取动态生成的多个edittext的值,android,android-edittext,Android,Android Edittext,我想要在多个编辑文本上设置文本值,单击按钮。编辑文本是动态生成的,我想要每个特定编辑文本的值。并将文本值存储在字符串数组中。这是代码 if (type.equalsIgnoreCase("Edittext")) { Question = cursor1.getString(cursor1 .getColumnIndex(AndroidOpenDbHelper.QUESTIONS));

我想要在多个编辑文本上设置文本值,单击按钮。编辑文本是动态生成的,我想要每个特定编辑文本的值。并将文本值存储在字符串数组中。这是代码

if (type.equalsIgnoreCase("Edittext")) {
                Question = cursor1.getString(cursor1
                        .getColumnIndex(AndroidOpenDbHelper.QUESTIONS));
                String ID = cursor1.getString(cursor1
                        .getColumnIndex(AndroidOpenDbHelper.ID));
                // ll_layout1 = (LinearLayout)
                // findViewById(R.id.linearlayout1);
                tv_edittext = new TextView(this);
                tv_edittext.setTextSize(20.0f);
                tv_edittext.setText(Question);
                ll_layout1.addView(tv_edittext);
                et = new EditText(this);
                et.setOnClickListener(this);
                et.setId(EDITTEXT);
                et.setMinLines(1);
                et.setMaxLines(3);
                // editTextList.add(et);
                ll_layout1.addView(et);
                // editTextList.add(et);

                typelist.add(Question);

            }
此代码生成文本和编辑文本如何启动。。。? 感谢您的帮助。

将其更改为

tv_edittext = new MyTextView(this);
其中MyTextView是:

public class MyTextView extends TextView{

    public SampleEditText(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        // TODO Auto-generated constructor stub
        this.addTextChangedListener(new MyTextWatcher());
    }

    public SampleEditText(Context context, AttributeSet attrs) {
        super(context, attrs);
        // TODO Auto-generated constructor stub
        this.addTextChangedListener(new MyTextWatcher());
    }

    public SampleEditText(Context context) {
        super(context);
        // TODO Auto-generated constructor stub
        this.addTextChangedListener(new MyTextWatcher());
    }

}
按如下方式使用textwatcher:

public class MyTextWatcher implements TextWatcher {

}

无论您动态创建多少文本视图,都会为其创建一个观察者,您可以在textwatcher的
onTextChanged
方法中获得正在键入的文本。

对不起,我不清楚这个问题。虽然问题不清楚,但我理解的是什么请参考此链接