I am making an activity in which an alertDialog will appear. The dialog will have a view which contains: Linear layout with two editText (Numeric texts) and then setHeight(wrapContent). You can see below.
Hope you are understanding now what i am doing. Here the view is a xml file which i created and it is not the activity's xml file. Now I want that when a user put the pin in the editText then i can get it and confirm it or whatever i want. But the problem is that i am not getting anything when i call getText(). Here is my code.
LayoutInflater factory = getLayoutInflater();
View view = factory.inflate(R.layout.zalert_pass_enable, null); // zalert_pass.. is the xml file
EditText passInput1 = view.findViewById(R.id.inputPass);
EditText passInput2 = view.findViewById(R.id.inputPassConfirm);
String value = passInput1.getText().toString().trim();
I edited my code to so that you can understand, this is not the actual code but it can easily tell my problem. When i toast the value String then i get nothing. Like there are 0 charaters. But i am putting 4 charaters at least each time. Now i know that the problem is in the process of linking the xml file to inflator.
infalInflater.inflate(R.layout.list_item, parent, false);
See the above line of code. This a well upvoted answer of stackOverflow. which tells us that we should not null the inflator. We should give it parent. But what will be the parent in my case.
You can see the picture and that is my problem and i want a solution for that, please help.