EDITTEXT - 复制值 [英] Edittext - copy values

查看:162
本文介绍了EDITTEXT - 复制值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我犯了一个程序,并在我的计划,我有一个 EDITTEXT 。我怎样才能获得的价值我的的EditText ...请帮助我,我不能让 excellent.getText()的toString();

有没有补救让我的EditText的价值?请帮我感谢你在..

下面是我的codeS ..

  TableLayout表=新TableLayout(getApplicationContext());
    table.setVerticalScrollBarEnabled(真);
    table.setPadding(10,10,10,10);    的TableRow的TableRow =新的TableRow(getApplicationContext());
    TextView的TXT =新的TextView(getApplicationContext());
    tableRow.addView(TXT);
    tableRow.setBackgroundColor(Color.GRAY);
    txt.setText(优秀);
    table.addView(tablerow的);    INT J = 0;
    为(J = 1; J< =计数; J ++){        的TableRow tableRow2 =新的TableRow(getApplicationContext());        优秀的EditText =新的EditText(getApplicationContext());
        tableRow2.addView(优秀);
    }    的TableRow tableRow1 =新的TableRow(getApplicationContext());    按钮showtable =新按钮(getApplicationContext());
    tableRow1.addView(showtable);
    showtable.setText(显示表);
    showtable.setTextSize(8);    showtable.setOnClickListener(新OnClickListener(){        @覆盖
        公共无效的onClick(查看为arg0){
            // TODO自动生成方法存根
            excellent.getText()的toString(); //我不能得到的价值
                                            //这里极好!
        }    });


解决方案

  TableLayout表=新TableLayout(getApplicationContext());
            table.setVerticalScrollBarEnabled(真);
            table.setPadding(10,10,10,10);
          优秀的EditText =新的EditText(getApplicationContext());
        的TableRow的TableRow =新的TableRow(getApplicationContext());
        TextView的TXT =新的TextView(getApplicationContext());
        tableRow.addView(TXT);
        tableRow.setBackgroundColor(Color.GRAY);
        txt.setText(优秀);
        table.addView(tablerow的);        INT J = 0;
        为(J = 1; J< =计数; J ++){
        的TableRow tableRow2 =新的TableRow(getApplicationContext());
        tableRow2.addView(优秀);
         }            的TableRow tableRow1 =新的TableRow(getApplicationContext());            按钮showtable =新按钮(getApplicationContext());
            tableRow1.addView(showtable);
            showtable.setText(显示表);
            showtable.setTextSize(8);
            showtable.setOnClickListener(新OnClickListener(){                @覆盖
                公共无效的onClick(查看为arg0){
                    // TODO自动生成方法存根
                       excellent.getText()的toString(); //我不能在这里得到优秀的价值!
              }            });

i made a program and in my program, i have an editText. How can i get the value of my edittext...please help me i can't get excellent.getText().toString();.

Is there a remedy to get the value of my edittext? Help me please thank you in advance..

here are my codes..

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 = 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!
              }

            });

这篇关于EDITTEXT - 复制值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆