I have an edit text. How can I make it non editable from the code.
By giving the tag android:editable
we can do in the layout.. But I need to do it in the code...Pls Help
Asked
Active
Viewed 1.1k times
0

dakshbhatt21
- 3,558
- 3
- 31
- 40

jennifer
- 8,133
- 22
- 69
- 96
4 Answers
4
I believe it is as simple as
editText.setEnabled(false);

user432209
- 20,007
- 10
- 56
- 75
-
its not working.. Please help.. The focus is still in the edit text. when i click that the i can edit – jennifer Jan 28 '11 at 04:10
-
1I got it....use edt.setClickable(false); edt.setFocusable(false); Also dont add properties like android:numeric in edit text..Otherwise it won't work
-
@jennifer --- android:enabled="false" use this in XML. – Rahul Baradia May 22 '12 at 10:00
1
If you didnt find yet an answer, i have found this in the net:

user229044
- 232,980
- 40
- 330
- 338

peet
- 11
- 1
1
I am using for this problem, this solution:
valueText.setEnabled(false);
valueText.setClickable(false);
valueText.setFocusable(false);
//Just for better text vision
valueText.setTextColor(Color.WHITE);

DariusK
- 11
- 1