Skip to content Skip to sidebar Skip to footer

Value Of Edittext In Custom Dialog

I have ListActivity , onClick of each item a Custom Dialog appears.Custom Dialog contains spinner and EditText Now i am not able to get the value of EditText, while debug value of

Solution 1:

The reason that you are not getting any values is because you are reinflating the layout just before you read the values, thus resetting values to the defaults. I suppose that you would like to findViewById on the v argument that was given to the onListItemClick method, instead of reinflating the layout.

That is, instead of

LayoutInflaterinflater= (LayoutInflater) CommonScreen6.this.getSystemService(LAYOUT_INFLATER_SERVICE);
Viewlayout= inflater.inflate(R.layout.answer_screen,null);
EditText editText=(EditText)layout.findViewById(R.id.remark);

try something like

EditText editText=(EditText)v.findViewById(R.id.remark);

You might need to make the v variable final, in order for this to work. I hope this helps.

Post a Comment for "Value Of Edittext In Custom Dialog"