public void editarEstadoSala(final Sala sala) {
ArrayAdapter<Pelicula> adapter;
CambiarDatosSalaWorker cambiarDatosSalaWorker = new CambiarDatosSalaWorker(this);
cambiarDatosSalaWorker.execute();
List<Pelicula> listaPelicula=cambiarDatosSalaWorker.getLista();
LinearLayout layout = new LinearLayout(PortalAdmin.this);
layout.setOrientation(LinearLayout.VERTICAL);
//////
final AlertDialog.Builder builder = new AlertDialog.Builder(PortalAdmin.this);
builder.setTitle("Rellena los datos");
final EditText butacas = new EditText(PortalAdmin.this);
final EditText precio = new EditText(PortalAdmin.this);
final TextView pelicula = new TextView(PortalAdmin.this);
final Spinner spinner = new Spinner(PortalAdmin.this);
pelicula.setText("Pelicula seleccionada");
// Specify the type of input expected; this, for example, sets the input as a password, and will mask the text
butacas.setInputType(InputType.TYPE_CLASS_NUMBER);
butacas.setHint("Numero butacas libres");
precio.setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL);
precio.setHint("Precio entrada");
spinner.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
adapter = new ArrayAdapter<Pelicula>(PortalAdmin.this, android.R.layout.simple_spinner_item , listaPelicula);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> parent, View view, int position, long id)
{
String item = (String) parent.getItemAtPosition(position);
pelicula.setText(item);
} // to close the onItemSelected
public void onNothingSelected(AdapterView<?> parent)
{
Toast toast = Toast.makeText(PortalAdmin.this,
"nada",
Toast.LENGTH_SHORT);
toast.show();
}
});
layout.addView(butacas);
layout.addView(precio);
layout.addView(pelicula);
layout.addView(spinner);
builder.setView(layout);
// Set up the buttons
builder.setPositiveButton("Subir", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
AlertDialog dialog = builder.create();
dialog.show();
}
[我只是无法在这里取得任何进展,微调器已填充(列表,来自另一个类),但是我无法对该数据进行任何操作,Log.e没有显示任何内容,因此我的代码无法到达spinner.setOnItemSelectedListener。
对不起,我的英语老师,我正在学习代码和英语,而我俩都不好。
好,问题出在这里