I have to set an embedded button when the editor is not empty but the project is in API 7. It is less for Android To do this: - / I tried this way:
edittxt.setOnFocusChangeListener (see new .onfocusChangeListener () {@Offride Change focus on Public Zero (see View, Boolean B) {if ( ! B) {if (! Edittxt.getText (). ToString () trim (.) Equals ("") {btn1.setEnabled (true);}}}}});
The app does not work. API 7 set is not available in the () method. Is there any way to make it? Thx
It looks like you were not adding your button to the layout or to find it before looking for you Do not see ViewById OnFocusChangeListener in your editing text you should add your button to the layout
And then call FindViewById like this:
button btn1 = (button) findViewById (R.id.button); EditTech edittxt = (Edit Text) Find ViewById (R.id.your_edit_text_id); Edittxt.setOnFocusChangeListener (New View. OnfocusChangeListener) {@Override Change focus on Public Zero (see View, Boolean B) {If (! B) {If (! Edittxt.getText (.) ToString () .tim (). "")) {Btn1.setEnabled (true);}}}});
Comments
Post a Comment