Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EditText.setFocusable(false); can't be set to true. :/

Tags:

java

android

A very strange situation, I've got this code that is supposed to make an EditText filed uneditable if SpnSelected.equals("Service") and editable again, if its something else.

final EditText etAdd = (EditText)dialogAddTextView.findViewById(R.id.etSymb);      if ( SpnSelected.equals("Service") )     {         etAdd.setFocusable(false);         TextView tvInfo = (TextView)dialogAddTextView.findViewById(R.id.tvAddTextInfo);     }     else     {         etAdd.setFocusable(true);         TextView tvInfo = (TextView)dialogAddTextView.findViewById(R.id.tvAddTextInfo);     }  

It does make it uneditable ok, but it doesn't bring the ability to edit back with etAdd.setFocusable(true);

Any ideas what to do about it? Thanks! :)

like image 650
Roger Avatar asked Sep 13 '11 20:09

Roger


1 Answers

Try

etAdd.setFocusableInTouchMode(true); etAdd.setFocusable(true); 

instead of just

etAdd.setFocusable(true); 
like image 98
Bala R Avatar answered Sep 20 '22 10:09

Bala R