Note that there are some explanatory texts on larger screens.

plurals
  1. POandroid spinner value set
    text
    copied!<p>am having <code>activity</code> First here am sending values got in to Second <code>activity</code>.</p> <p>in second <code>activity</code> contain <code>textview</code> and <code>spinner</code> . here <code>spinner</code> contains values as johncena ,Rock,undertaker....</p> <p>so in <code>activity</code> am getting values as card2 and Rock which am passing to nextscreen through <code>intent</code>.so in next <code>activity</code> <code>cardNumber.setText(cardReceived);</code> so here for <code>textview</code> we are giving like above for <code>spinner</code> how we have to do.</p> <p>so when i navigate from first <code>activity</code> to nextactivity <code>spinner</code> value has to display as Rock.</p> <p>but it shows default value johncena.</p> <p>similarly if i get values as card 3 and undertaker then if i navigates to second <code>activity</code> then it has to display card3 and undertaker (for <code>spinner</code>).</p> <p>but it shows card3 and johncena (default value)</p> <pre><code>Intent send =new Intent(First.this, Second.class); send.putExtra("card",cardList.get(position)); send.putExtra("name",nameList.get(position)); startActivity(edit); String cardReceived = getIntent().getStringExtra("card"); cardNumber =(EditText)findViewById(R.id.cardnumber); cardNumber.setText(cardReceived); String nameReceived = getIntent().getStringExtra("name"); System.out.println("name "+nameReceived); Spinner NameDetail = (Spinner) findViewById(R.id.spinner1); List list = new ArrayList(); list.add("Johncena"); list.add("Rock"); list.add("UnderTaker"); ArrayAdapter dataAdapter = new ArrayAdapter(this,android.R.layout.simple_spinner_item, list); dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); cardDetail.setAdapter(dataAdapter); </code></pre>
 

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