No problem, this is a basic mistake that happens regularly. You are
re-creating that ArrayAdapter within an OnItemSelectedListener:
*spPaises.setOnItemSelectedListener(*
* new AdapterView.OnItemSelectedListener() {*
* *
* public void onItemSelected(AdapterView<?> parent,*
* android.view.View v, int position, long id) {*
* *
* *
* idPais=obtIdPais(ListaPaises[position],BdWorld); *
* ListaCiudades=obtListaDeCiudades(BdWorld,idPais);*
* ArrayAdapter<String> adaptador2 =new
ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,
ListaCiudades);*
*
adaptador2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
*
* spCiudades.setAdapter(adaptador2);*
* *
* }*
*
*And literally* "this" *is also the problem, because the Java keyword*"this"
*refers to the object within the scope where that keyword occurs. The scope
is in that case your OnItemSelectedListener and *not* the surrounding
Activity class. You need to write the following instead:*
**ArrayAdapter<String> adaptador2 =new ArrayAdapter<String>(**
VisualizadorClimaticoActivity.**this,android.R.layout.simple_spinner_item,
ListaCiudades);*
*
*
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en