I have a spinner item and the value has been inserted to SQLite.Now I want to retrieve the item out to another spinner which is in Update.java.
Information.java
public void addItemsOnSpinner2() {
spinner2 = (Spinner) findViewById(R.id.spinner2);
List<String> list = new ArrayList<String>();
list.add("Sunny");
list.add("Cloudy");
list.add("Rainy");
list.add("Thunderstorm");
ArrayAdapter<String> adapter = new ArrayAdapter<String>(Information.this, android.R.layout.simple_spinner_dropdown_item, list);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner2.setAdapter(adapter);
Update.java
final Spinner weather3 = (Spinner) findViewById(R.id.spinner5);
String Weather = c.getString(c.getColumnIndexOrThrow(MyDatabaseHelper.Weather));
weather3.setText(Weather);
Of course this method doesn't work and the setText cannot be resolved. I've been searching the solution for a long time but it seems like not much information can be found . Any idea or suggestions would be greatly appreciated.
Aucun commentaire:
Enregistrer un commentaire