您好我在滚动视图中动态添加编辑文本字段然后在编辑文本中添加文本然后我想将数据恢复到字符串数组中...因为我写了下面的代码请建议我如何从编辑文本获取数据..`for(int i = 0; i
value=(EditText)row.findViewById(R.id.EditText01);
Button sayit=(Button)row.findViewById(R.id.sayit);
Button sentence=(Button)row.findViewById(R.id.sentences);
TextView positions=(TextView)row.findViewById(R.id.positions);
TextView sentenc=(TextView)row.findViewById(R.id.sentence);
positions.setText(String.valueOf(i));
sentenc.setText(String.valueOf(i));
sayit.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
TextView t=(TextView)row.findViewById(R.id.positions);
String s=t.getText().toString();
int j=Integer.parseInt(s);
mTts.speak(field_wordsundvalue[j],TextToSpeech.QUEUE_FLUSH,null);
}
});
sentence.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
TextView t1=(TextView)row.findViewById(R.id.sentence);
String s=t1.getText().toString();
int j=Integer.parseInt(s);
mTts.speak(field_sentencesundvalue[j],TextToSpeech.QUEUE_FLUSH,null);
}
});
ll.addView(row);
mylist.add(value);
}`
答案 0 :(得分:2)
以下代码用于从编辑文本
获取文本String str = myEditText.getText().toString().trim();
答案 1 :(得分:0)
尝试
value.getText().toString()