Update A Spinner In Android
In my application I have 1 spinner option. In that I am displaying 6 values (which is array from values file). Now in that when I click its 5 items of the spinner value the selecte
Solution 1:
It's possible
Codings:
ArrayAdapter yearadp = new ArrayAdapter(this,android.R.layout.simple_spinner_item, yearlist);
yearadp.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
year_spinner.setAdapter(yearadp);
index=0;
year_spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
publicvoidonItemSelected(AdapterView<?> parent, View view, int pos, long id) {
spintext=parent.getItemAtPosition(pos).toString();
if(spintext=="6")
{
intent = new Intent(ListMonthActivity.this,NewChart.class);
startActivity(intent);
}
}
}
Ya we can do with setting with
mon_spinner.setSelection(iSelectedMonth);
intent = newIntent(ListMonthActivity.this,NewChart.class);
You may or not mention while the action are certain action finished, and you can passed into another activity .
Post a Comment for "Update A Spinner In Android"