Ver Mensaje Individual
  #1 (permalink)  
Antiguo 06/03/2013, 08:08
sheshito
 
Fecha de Ingreso: septiembre-2008
Mensajes: 257
Antigüedad: 15 años, 7 meses
Puntos: 4
Me da un error al presionar un boton

Saludos, nuevamente solicitando su ayuda amigos, lo que pasa esq desde un layout quiero llamar a otro al presionar un boton, para ello utilizo este metodo y lo llamo desde el evento Onclic del boton este es el codigo:
Código:
public void regresainicio(View v){
         
                  
         Intent i=new Intent(EmpleadosActivity.this, MainActivity.class);
            startActivity(i);
     }
Este mismo codigo lo utilizo en otro layout y ahi m funciona bien..solo es un layout me da error y este es el error q me sale.

Código:
03-05 23:53:17.009: E/AndroidRuntime(2604): FATAL EXCEPTION: main
03-05 23:53:17.009: E/AndroidRuntime(2604): java.lang.IllegalStateException: Could not find a method regresainicio(View) in the activity class com.example.taller06oct.BuscarEmpleado for onClick handler on view class android.widget.Button with id 'button1'
03-05 23:53:17.009: E/AndroidRuntime(2604):     at android.view.View$1.onClick(View.java:2131)
03-05 23:53:17.009: E/AndroidRuntime(2604):     at android.view.View.performClick(View.java:2485)
03-05 23:53:17.009: E/AndroidRuntime(2604):     at android.view.View$PerformClick.run(View.java:9080)
03-05 23:53:17.009: E/AndroidRuntime(2604):     at android.os.Handler.handleCallback(Handler.java:587)
03-05 23:53:17.009: E/AndroidRuntime(2604):     at android.os.Handler.dispatchMessage(Handler.java:92)
03-05 23:53:17.009: E/AndroidRuntime(2604):     at android.os.Looper.loop(Looper.java:123)
03-05 23:53:17.009: E/AndroidRuntime(2604):     at android.app.ActivityThread.main(ActivityThread.java:3683)
03-05 23:53:17.009: E/AndroidRuntime(2604):     at java.lang.reflect.Method.invokeNative(Native Method)
03-05 23:53:17.009: E/AndroidRuntime(2604):     at java.lang.reflect.Method.invoke(Method.java:507)
03-05 23:53:17.009: E/AndroidRuntime(2604):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
03-05 23:53:17.009: E/AndroidRuntime(2604):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
03-05 23:53:17.009: E/AndroidRuntime(2604):     at dalvik.system.NativeStart.main(Native Method)
03-05 23:53:17.009: E/AndroidRuntime(2604): Caused by: java.lang.NoSuchMethodException: regresainicio
03-05 23:53:17.009: E/AndroidRuntime(2604):     at java.lang.ClassCache.findMethodByName(ClassCache.java:247)
03-05 23:53:17.009: E/AndroidRuntime(2604):     at java.lang.Class.getMethod(Class.java:962)
03-05 23:53:17.009: E/AndroidRuntime(2604):     at android.view.View$1.onClick(View.java:2124)
03-05 23:53:17.009: E/AndroidRuntime(2604):     ... 11 more