0

My requirement is that when user clicks on edittext, a dialog should pop up enabling the user to select one of the values from lit.

The above portion has been accomplished.

I do not want user to enter/edit any other value than values given in list in dialog. I want user to select only the values given in list in dialog.

I am facing the problem in accomplishing this part.

Please help.Many thanks in advance.

Regards, Pawan

3 Answers3

1

See This answer.

From the link:

Add android:focusable="false" to your EditText. And set OnClickListener to that EditText. The click on that Edittext triggers the onClick() method but it can't be edited.

Community
  • 1
  • 1
Jonas Czech
  • 12,018
  • 6
  • 44
  • 65
0

How about setting inputtype of EditText to null?

Programatically:

editText.setInputType(InputType.TYPE_NULL);

XML:

android:inputType="none"

The edtText.setText(String) method will still work normally.

electrocrat
  • 446
  • 3
  • 8
0

Setting android:focusable="false" worked for me. It will not enable user to edit data and force him to select from list in dialog.

Thanks @JonasCz for answer