so i started android programming like a month ago, and i’ve got a probleme today.
The thing i want to do is : From a Item in the Spinner, when i select it there is a Text View changing on the back.
spin.setAdapter(adapter_city);
spin.setOnItemClickListener(this);
}
@Override
public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
switch(v.getId()){
case R.string.Paris : description.setText("blah blah");
}
}
and i would like the description fit with the resource.
Paris is in a xml called “cities”, it’s a value xml.
Thank you.
If you call
parent.getItemAtPosition(position), it will give you back to actualStringyou put in to the spinner. Then you can compare this withgetString(R.string.Paris)to see if they are the same, and act accordingly. You cannot switch on aStringin Java, so you just have to write a someifstatements.