title: java.lang.IllegalStateException: couldn't execute method of the activity
body: <pre><code>import android.app.Activity;
  import android.content.Intent;
  import android.database.Cursor;
  import android.database.sqlite.SQLiteDatabase;
  import android.os.Bundle;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  import android.widget.Button;
  import android.widget.Toast;
  
  public class PantallaProductos extends Activity{
  private Button btn1,btn2,btn3,btn4;
  private double total=0.00;
  AdminBD admin;
  SQLiteDatabase bd;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.pant_prod);
  
      btn1 = (Button) findViewById(R.id.cuaderno);
      btn2 = (Button) findViewById(R.id.lapicero);
      btn3 = (Button) findViewById(R.id.borrador);
      btn4 = (Button) findViewById(R.id.corrector);
      admin = new AdminBD(this, "BDHHL", null, 1);
      bd = admin.getWritableDatabase();
  
  
  }
  
  
  public void lanzarCuaderno(View v) {
      String precio="";
  
  
      String nombreBoton = btn1.getText().toString();
      Cursor fila = bd.rawQuery(
              "SELECT precio from Producto WHERE nombre='" + nombreBoton + "'", null);
      if( fila != null &amp;&amp; fila.moveToFirst() ){
          precio = fila.getString(0);
          fila.close(); 
      }else
          Toast.makeText(this, "No existe un producto con ese nombre",       Toast.LENGTH_SHORT).show();
  
      bd.close();
  
      Bundle b = new Bundle();
      b.putDouble("PRECIO", Double.valueOf(precio));
  
  
      Intent i = new Intent(this,PantallaCantidad.class);
      i.putExtras(b);
      startActivityForResult(i, 1);
  
  
  
  }
  </code></pre>
  
  <p>The logcat give me: java.lang.IllegalStateException: could not execute method of the activity , when trigger the method "lanzarCuaderno". Can anyone give me an idea of how to solve this?, please.</p>
  
  <p>this shows the logcat:</p>
  
  <pre><code>12-10 01:05:00.414: E/AndroidRuntime(1542): FATAL EXCEPTION: main
  12-10 01:05:00.414: E/AndroidRuntime(1542): Process: com.empresa.sistventas, PID: 1542
  12-10 01:05:00.414: E/AndroidRuntime(1542): java.lang.IllegalStateException: Could not execute method of the activity
  12-10 01:05:00.414: E/AndroidRuntime(1542):     at android.view.View$1.onClick(View.java:4007)
  12-10 01:05:00.414: E/AndroidRuntime(1542):     at android.view.View.performClick(View.java:4756)
  12-10 01:05:00.414: E/AndroidRuntime(1542):     at android.view.View$PerformClick.run(View.java:19749)
  12-10 01:05:00.414: E/AndroidRuntime(1542):     at android.os.Handler.handleCallback(Handler.java:739)
  12-10 01:05:00.414: E/AndroidRuntime(1542):     at android.os.Handler.dispatchMessage(Handler.java:95)
  12-10 01:05:00.414: E/AndroidRuntime(1542):     at android.os.Looper.loop(Looper.java:135)
  12-10 01:05:00.414: E/AndroidRuntime(1542):     at android.app.ActivityThread.main(ActivityThread.java:5221)
  12-10 01:05:00.414: E/AndroidRuntime(1542):     at java.lang.reflect.Method.invoke(Native Method)
  12-10 01:05:00.414: E/AndroidRuntime(1542):     at java.lang.reflect.Method.invoke(Method.java:372)
  12-10 01:05:00.414: E/AndroidRuntime(1542):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
  12-10 01:05:00.414: E/AndroidRuntime(1542):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
  12-10 01:05:00.414: E/AndroidRuntime(1542): Caused by: java.lang.reflect.InvocationTargetException
  12-10 01:05:00.414: E/AndroidRuntime(1542):     at java.lang.reflect.Method.invoke(Native Method)
  12-10 01:05:00.414: E/AndroidRuntime(1542):     at java.lang.reflect.Method.invoke(Method.java:372)
  12-10 01:05:00.414: E/AndroidRuntime(1542):     at android.view.View$1.onClick(View.java:4002)
  12-10 01:05:00.414: E/AndroidRuntime(1542):     ... 10 more
  12-10 01:05:00.414: E/AndroidRuntime(1542): Caused by: android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 0
  12-10 01:05:00.414: E/AndroidRuntime(1542):     at android.database.AbstractCursor.checkPosition(AbstractCursor.java:426)
  12-10 01:05:00.414: E/AndroidRuntime(1542):     at android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:136)
  12-10 01:05:00.414: E/AndroidRuntime(1542):     at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:50)
  12-10 01:05:00.414: E/AndroidRuntime(1542):     at com.empresa.sistventas.PantallaProductos.lanzarCuaderno(PantallaProductos.java:47)
  12-10 01:05:00.414: E/AndroidRuntime(1542):     ... 13 more
  </code></pre>