-1

I wanna have an EditText which can be updated only programmatically. When I click on it, I will not be able to enter anything, but when I click the button with requestFocus to this EditText I want to have that option.

I tried android:focusableInTouchMode="true", but in this case, I can't use EditText when I click button either.

Any ideas?

General Grievance
  • 4,555
  • 31
  • 31
  • 45
toja6755
  • 23
  • 7

2 Answers2

0

You can enable or disable the EditText.

android:enabled="false"

And when you click on your button, you have to do :

myEditText.setEnabled(true)
Bruno
  • 3,872
  • 4
  • 20
  • 37
0

Use attributes of EditText android:enabled="false" and in your button event handler use ((EditText)findViewById(R.id.edittext)).setEnabled(true); if id of EditText is edittext.