开发者

How can I Validate the edit text and store the values in Android?

开发者 https://www.devze.com 2023-03-13 14:34 出处:网络
I am creating one function inside the button and call the function outside. When I click the button will call ...

I am creating one function inside the button and call the function outside. When I click the button will call ...

Inside the function. Creating one Table layout and Table row. In the table row, I am creating edit text. How can I validate the edit text and store the values开发者_如何转开发.

Suppose I am click the button first time means one edit text will displayed, after entering the values, then I click button another edit text will displayed etc... How can I store the values in array list. And also validate the edit text, if it null means the the button will not.


Set your button disabled when there is edit text without any data i.e as soon as edit text is displayed

btn.setEnabled(false);

and enable in on

et.setOnKeyListener(new View.OnKeyListener() {

        public boolean onKey(View v, int keyCode, KeyEvent event) {
            btn.setEnabled(true);
        }
    });

where et is your editText

PS: Your question is not clear. The answer is just for what I understand.

0

精彩评论

暂无评论...
验证码 换一张
取 消