Android Edittext-复制值
我制作了一个程序,在我的程序中,我有一个Android Edittext-复制值,android,Android,我制作了一个程序,在我的程序中,我有一个editText。如何获取我的edittext…请帮助我,我无法获取优秀的.getText().toString() 有什么补救办法可以获得我的编辑文本的价值吗?请帮帮我,先谢谢你 这是我的密码 TableLayout table = new TableLayout(getApplicationContext()); table.setVerticalScrollBarEnabled(true); table.setPadding(10,
editText
。如何获取我的edittext
…请帮助我,我无法获取优秀的.getText().toString()代码>
有什么补救办法可以获得我的编辑文本的价值吗?请帮帮我,先谢谢你
这是我的密码
TableLayout table = new TableLayout(getApplicationContext());
table.setVerticalScrollBarEnabled(true);
table.setPadding(10, 10, 10, 10);
TableRow tableRow = new TableRow(getApplicationContext());
TextView txt = new TextView(getApplicationContext());
tableRow.addView(txt);
tableRow.setBackgroundColor(Color.GRAY);
txt.setText("Excellent ");
table.addView(tableRow);
int j = 0;
for (j = 1; j <= count; j++) {
TableRow tableRow2 = new TableRow(getApplicationContext());
EditText excellent = new EditText(getApplicationContext());
tableRow2.addView(excellent);
}
TableRow tableRow1 = new TableRow(getApplicationContext());
Button showtable = new Button(getApplicationContext());
tableRow1.addView(showtable);
showtable.setText("Show Table");
showtable.setTextSize(8);
showtable.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
excellent.getText().toString();// i cant get the value of
// excellent here!
}
});
TableLayout table=newtablelayout(getApplicationContext());
table.setVerticalScrollBarEnabled(真);
表.设置填充(10,10,10,10);
TableRow TableRow=新的TableRow(getApplicationContext());
TextView txt=新建TextView(getApplicationContext());
tableRow.addView(txt);
tableRow.setBackgroundColor(颜色:灰色);
txt.setText(“优秀”);
table.addView(tableRow);
int j=0;
对于(j=1;j在方法之外创建优秀的参考
TableLayout table = new TableLayout(getApplicationContext());
table.setVerticalScrollBarEnabled(true);
table.setPadding(10, 10, 10, 10);
EditText excellent;
TableRow tableRow = new TableRow (getApplicationContext());
TextView txt = new TextView (getApplicationContext());
tableRow.addView(txt);
tableRow.setBackgroundColor(Color.GRAY);
txt.setText("Excellent ");
table.addView(tableRow);
int j=0;
for(j = 1; j<=count; j++){
TableRow tableRow2 = new TableRow (getApplicationContext());
excelent = new EditText (getApplicationContext());
tableRow2.addView(excellent);
}
TableRow tableRow1 = new TableRow (getApplicationContext());
Button showtable = new Button(getApplicationContext());
tableRow1.addView(showtable);
showtable.setText("Show Table");
showtable.setTextSize(8);
showtable.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
excellent.getText().toString();//i cant get the value of excellent.
}
});
TableLayout table=newtablelayout(getApplicationContext());
table.setVerticalScrollBarEnabled(真);
表.设置填充(10,10,10,10);
编辑文本优秀;
TableRow TableRow=新的TableRow(getApplicationContext());
TextView txt=新的TextView(getApplicationContext());
tableRow.addView(txt);
tableRow.setBackgroundColor(颜色:灰色);
txt.setText(“优秀”);
table.addView(tableRow);
int j=0;
对于(j=1;jTableLayout table=newtablelayout(getApplicationContext());
table.setVerticalScrollBarEnabled(真);
表.设置填充(10,10,10,10);
EditText=newEditText(getApplicationContext());
TableRow TableRow=新的TableRow(getApplicationContext());
TextView txt=新的TextView(getApplicationContext());
tableRow.addView(txt);
tableRow.setBackgroundColor(颜色:灰色);
txt.setText(“优秀”);
table.addView(tableRow);
int j=0;
对于(j=1;j从该代码中,您似乎有几个(计数)优秀的EditText。那么您指的是哪一个呢?全局定义优秀,这是在函数的外面您在EditText中输入了任何值吗?@Dio Baccay全局声明您的优秀。@GrIsHu是的,我全局声明了它,它工作了!:)
TableLayout table = new TableLayout(getApplicationContext());
table.setVerticalScrollBarEnabled(true);
table.setPadding(10, 10, 10, 10);
EditText excellent = new EditText (getApplicationContext());
TableRow tableRow = new TableRow (getApplicationContext());
TextView txt = new TextView (getApplicationContext());
tableRow.addView(txt);
tableRow.setBackgroundColor(Color.GRAY);
txt.setText("Excellent ");
table.addView(tableRow);
int j=0;
for(j = 1; j<=count; j++){
TableRow tableRow2 = new TableRow (getApplicationContext());
tableRow2.addView(excellent);
}
TableRow tableRow1 = new TableRow (getApplicationContext());
Button showtable = new Button(getApplicationContext());
tableRow1.addView(showtable);
showtable.setText("Show Table");
showtable.setTextSize(8);
showtable.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
excellent.getText().toString();//i cant get the value of excellent here!
}
});