Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/11/2011, 20:46
Alemanarg
 
Fecha de Ingreso: julio-2008
Ubicación: Buenos Aires, Mar del plata
Mensajes: 250
Antigüedad: 15 años, 9 meses
Puntos: 2
Aplicacion con boton de salir

Hola!
Estoy intentando armar una aplicacion donde tenga el boton salir, y que salga. Simplemente eso, mas algun texto.
El tema que me aparecen los errores:

OnClickListener cannot be resolved to a type

The method setOnClickListener(View.OnClickListener) in the type View is not applicable for the arguments (new OnClickListener(){})

Intenté ya varias cosas. Entre otras, borrar el @Override, y agregar el boton al AndroidManifest.xml

Será alguna cosa de configuracion?

Les dejo el codigo:

public class PruebaBotonActivity extends Activity {
/** Called when the activity is first created. */

public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

Button boton1 = (Button) findViewById(R.id.button1);

//Implementación del botón "Salir"
boton1.setOnClickListener(new OnClickListener() {

public void onClick(View v) {
setResult(RESULT_OK);
finish();
}
});
}

Gracias!!