Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't get String which is entered into Edit Text in ExpandableListView(Not the usual Focus issue)
    text
    copied!<p>Hey so basically I have a Sign-in/Register screen for an app and I have to make it using an ExpandableListView as shown. </p> <p>Based on the position of the child in a group I have inflated different views. So for positions 0 and 1, I have inflated 2 different EditText boxes. </p> <p>My problem is I can't get the text that is typed in both the boxes.</p> <p>The box allows me to type continuously but when I click the Sign-In button, the strings I get from the username and password boxes using getText are both null!</p> <p><a href="http://img801.imageshack.us/img801/5544/shot000005w.png" rel="nofollow noreferrer">Sign-In screen shot http://img801.imageshack.us/img801/5544/shot000005w.png</a> <a href="http://img21.imageshack.us/img21/3825/shot000006y.png" rel="nofollow noreferrer">Username Toast is blank http://img21.imageshack.us/img21/3825/shot000006y.png</a> <a href="http://img542.imageshack.us/img542/8804/shot000007.png" rel="nofollow noreferrer">Password Toast is blank http://img542.imageshack.us/img542/8804/shot000007.png</a></p> <p>Here's the get getChildView from the CustomExpandableAdapter: </p> <pre><code>public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { v = null; position = 0; position=getChildId(groupPosition, childPosition); if(position==0) //draw the username editbox { v = inflater.inflate(R.layout.username, parent, false); Element c = (Element)getChild( groupPosition, childPosition ); username = (EditText)v.findViewById( R.id.username); if( username != null ) username.setHint(c.getElement()); } else if(position==1) { if(convertView == inflater.inflate(R.layout.password, parent, false)) return convertView; v = inflater.inflate(R.layout.password, parent, false); convertView = inflater.inflate(R.layout.password, parent, false); Element c = (Element)getChild( groupPosition, childPosition ); password = (EditText)v.findViewById( R.id.password); if( password != null ) password.setHint(c.getElement()); } else if (position&gt;1023 &amp;&amp; position&lt;1028) { v = inflater.inflate(R.layout.child_row, parent, false); Element c = (Element)getChild( groupPosition, childPosition ); et = (EditText)v.findViewById( R.id.et); if( et != null ) et.setHint(c.getElement()); } else if(position==1028) { v = inflater.inflate(R.layout.gender, parent, false); ArrayAdapter&lt;CharSequence&gt; adapter = ArrayAdapter.createFromResource( context, R.array.gender, android.R.layout.simple_spinner_item ); adapter.setDropDownViewResource( android.R.layout.simple_spinner_dropdown_item ); s = (Spinner) v.findViewById( R.id.spinner_gend ); s.setAdapter( adapter ); } else if(position==2) //Forgot Button { v = inflater.inflate(R.layout.forgot, parent, false); Button forgot = (Button)v.findViewById(R.id.fpb); forgot.setOnClickListener(this); } else if(position==3) //Sign-in Button { v = inflater.inflate(R.layout.sign_in_button, parent, false); ImageButton sign_in = (ImageButton)v.findViewById(R.id.sign_in_button); sign_in.setOnClickListener(this); } return v; } </code></pre> <p>and later on in the code I have the onClick of the Sign in button:</p> <pre><code>case R.id.sign_in_button: { String user_name = username.getText().toString(); String pass_word=password.getText().toString(); Toast.makeText(context,"u:"+ user_name, 3000).show(); Toast.makeText(context, "p:"+pass_word, 3000).show(); //Other unrelated Database Code } </code></pre> <p>Here the Toasts always show just u: and p:</p> <p>Someone help!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload