Note that there are some explanatory texts on larger screens.

plurals
  1. POi've got some problems with my spinner
    primarykey
    data
    text
    <p>So i'm starting a application and the first thing to do is make a description of a city when the city is selected. I can show the description but it make the description of all the cities on the same time and it don't come out when i select another city : it add more and more .</p> <p>this is my code :</p> <p>public class Main extends Activity implements OnItemClickListener, OnItemSelectedListener {</p> <pre><code>TextView description; Spinner spin; ArrayAdapter adapter_city; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); description = (TextView)findViewById(R.id.description); spin = (Spinner)findViewById(R.id.spin); adapter_city = ArrayAdapter.createFromResource(this, R.array.Cities, android.R.layout.simple_spinner_item); adapter_city.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spin.setAdapter(adapter_city); spin.setOnItemSelectedListener(this); } @Override public void onItemClick(AdapterView&lt;?&gt; parent, View v, int position, long id) { } @Override public void onItemSelected(AdapterView&lt;?&gt; parent, View v, int position, long id) { switch(position){ case 0 : description.append(getString(R.string.Paris)); case 1 : description.append(getString(R.string.Chicago)); case 2 : description.append(getString(R.string.NewYork)); } } @Override public void onNothingSelected(AdapterView&lt;?&gt; parent) { } </code></pre> <p>thank you .</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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