M getting this Exception java.lang.IllegalStateException: Could not execute method of the activity
<blockquote>
  <p>java.lang.IllegalStateException: Could not execute method of the activity .</p>
</blockquote>

<p>I am new to Android.  want to display stored data from database.<br>
This is my Compview class which is getting error.</p>

<pre><code>  @Override
     public void onCreate(Bundle savedInstanceState) 
     {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.compview);


        DB = (new DBHelper(this)).getWritableDatabase();
        // searchText = (EditText) findViewById (R.id.searchText);

         eun = (TextView)findViewById(R.id.textV);
   Bundle bundle = getIntent().getExtras();

   String UName = bundle.getString("UserName");

   eun.setText(UName);



     }

  public void search(View view)
  {DB.isReadOnly();
   cursor = DB.rawQuery("SELECT _id, Cname, Cpost, Ccriteria, Cemail,Ccontact,Ccutoff FROM Comp WHERE Cusername LIKE ?", 
     new String[] {"%" + eun.getText().toString() + "%"});
   adapter = new SimpleCursorAdapter(
     this,
     R.layout.cmpinfo,
     cursor,
     new String[] {" Cname", "Cpost", "Ccriteria", "Cemail","Ccontact","Ccutoff"},
     new int[] {R.id.cname, R.id.cpost, R.id.ccriteria , R.id.cemail, R.id.ccontact, R.id.ccutoff});


   setListAdapter(adapter);
  }

  @Override
  public void onBackPressed() 
  {
   super.onBackPressed();
   Intent i = new Intent(CompView.this, LoginActivity.class);
   startActivity(i);
  }
  }
</code></pre>

<p>LOGCAT</p>

<pre><code>04-09 01:32:54.322: W/dalvikvm(4302): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
04-09 01:32:54.342: E/AndroidRuntime(4302): FATAL EXCEPTION: main
04-09 01:32:54.342: E/AndroidRuntime(4302): java.lang.IllegalStateException: Could not execute method of the activity
04-09 01:32:54.342: E/AndroidRuntime(4302):     at android.view.View$1.onClick(View.java:2072)
04-09 01:32:54.342: E/AndroidRuntime(4302):     at android.view.View.performClick(View.java:2408)
04-09 01:32:54.342: E/AndroidRuntime(4302):     at android.view.View$PerformClick.run(View.java:8816)
04-09 01:32:54.342: E/AndroidRuntime(4302):     at android.os.Handler.handleCallback(Handler.java:587)
04-09 01:32:54.342: E/AndroidRuntime(4302):     at android.os.Handler.dispatchMessage(Handler.java:92)
04-09 01:32:54.342: E/AndroidRuntime(4302):     at android.os.Looper.loop(Looper.java:123)
04-09 01:32:54.342: E/AndroidRuntime(4302):     at android.app.ActivityThread.main(ActivityThread.java:4627)
04-09 01:32:54.342: E/AndroidRuntime(4302):     at java.lang.reflect.Method.invokeNative(Native Method)
04-09 01:32:54.342: E/AndroidRuntime(4302):     at java.lang.reflect.Method.invoke(Method.java:521)
04-09 01:32:54.342: E/AndroidRuntime(4302):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-09 01:32:54.342: E/AndroidRuntime(4302):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-09 01:32:54.342: E/AndroidRuntime(4302):     at dalvik.system.NativeStart.main(Native Method)
04-09 01:32:54.342: E/AndroidRuntime(4302): Caused by: java.lang.reflect.InvocationTargetException
04-09 01:32:54.342: E/AndroidRuntime(4302):     at com.google.data.CompView.search(CompView.java:68)
04-09 01:32:54.342: E/AndroidRuntime(4302):     at java.lang.reflect.Method.invokeNative(Native Method)
04-09 01:32:54.342: E/AndroidRuntime(4302):     at java.lang.reflect.Method.invoke(Method.java:521)
04-09 01:32:54.342: E/AndroidRuntime(4302):     at android.view.View$1.onClick(View.java:2067)
04-09 01:32:54.342: E/AndroidRuntime(4302):     ... 11 more
04-09 01:32:54.342: E/AndroidRuntime(4302): Caused by: java.lang.IllegalArgumentException: column ' Cname' does not exist
04-09 01:32:54.342: E/AndroidRuntime(4302):     at android.database.AbstractCursor.getColumnIndexOrThrow(AbstractCursor.java:314)
04-09 01:32:54.342: E/AndroidRuntime(4302):     at android.widget.SimpleCursorAdapter.findColumns(SimpleCursorAdapter.java:312)
04-09 01:32:54.342: E/AndroidRuntime(4302):     at android.widget.SimpleCursorAdapter.&lt;init&gt;(SimpleCursorAdapter.java:87)
04-09 01:32:54.342: E/AndroidRuntime(4302):     ... 15 more
</code></pre>

<p>DBHelper class</p>

<pre><code>  public class DBHelper extends SQLiteOpenHelper 


{
 private SQLiteDatabase db;
 public static final String KEY_ROWID = "_id";
 public static final String KEY_ROWID1 = "_id";
    public static final String KEY_FNAME = "firstname";
    public static final String KEY_LNAME = "lastname";
    public static final String KEY_GENDER = "gender";
    public static final String KEY_USER = "username";
    public static final String KEY_EMAIL = "email";
    public static final String KEY_CNAME="Cname"; 
    public static final String KEY_CPOST="Cpost"; 
    public static final String KEY_CCRITERIA="Ccriteria"; 
    public static final String KEY_CUSER="Cusername"; 
    public static final String KEY_CEMAIL="Cemail"; 
    public static final String KEY_CCONTACT="Ccontact"; 
    public static final String KEY_CCUTOFF="Ccutoff"; 


 DBHelper DB = null;
 private static final String DATABASE_NAME = "Sam1.db";
 private static final int DATABASE_VERSION = 2;
    public static final String DATABASE_TABLE_NAME = "JobSeeker";
    public static final String Company_Table = "Comp";
    private static final String DATABASE_TABLE_CREATE =
            "CREATE TABLE " + DATABASE_TABLE_NAME + "(" +
            "_id INTEGER PRIMARY KEY AUTOINCREMENT,"+
            "firstname TEXT NOT NULL, lastname TEXT NOT NULL, gender TEXT NOT NULL, username TEXT NOT NULL, password TEXT NOT NULL, email TEXT NOT NULL);";
private static final String DATABASE_TABLE_CREATE2=
" create table " + Company_Table +
" (_id integer primary key autoincrement," +
" Cname TEXT NOT NULL, Cpost TEXT NOT NULL,Ccriteria TEXT NOT NULL,Cusername TEXT NOT NULL, Cpassword TEXT NOT NULL, Cemail TEXT NOT NULL,Ccontact TEXT NOT NULL,Ccutoff TEXT NOT NULL);" ;


    public DBHelper(Context context) {

  super(context, DATABASE_NAME, null, DATABASE_VERSION);
  System.out.println("In constructor");
}




@Override
public void onCreate(SQLiteDatabase db) {

 try{

  db.execSQL(DATABASE_TABLE_CREATE);
  db.execSQL(DATABASE_TABLE_CREATE2);



 }catch(Exception e){
  e.printStackTrace();
 }
}






@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
 // TODO Auto-generated method stub

}




public Cursor rawQuery(String string, String[] strings) {
 // TODO Auto-generated method stub
 return null;
}




public void open() {

 getWritableDatabase(); 
}


public Cursor getDetails(String text) throws SQLException 
{

    Cursor mCursor =
            db.query(true, DATABASE_TABLE_NAME, 
              new String[]{KEY_ROWID, KEY_FNAME, KEY_LNAME, KEY_GENDER, KEY_USER, KEY_EMAIL}, 
              KEY_USER + "=" + text, 
              null, null, null, null, null);
    if (mCursor != null) 
    {
        mCursor.moveToFirst();
    }
    return mCursor;


}

public Cursor getCompDetails(String text) throws SQLException 
{

    Cursor mCursor =
            db.query(true, Company_Table, 
              new String[]{KEY_ROWID1, KEY_CNAME, KEY_CPOST, KEY_CCRITERIA, KEY_CUSER, KEY_EMAIL,KEY_CCONTACT,KEY_CCUTOFF}, 
              KEY_CUSER + "=" + text, 
              null, null, null, null, null);
    if (mCursor != null) 
    {
        mCursor.moveToFirst();
    }
    return mCursor;


}


}
</code></pre>

<p>This my welcome1 class which is working fine and able to retrieve all the data from database but when am using same method for my compview class to access data  its not working.!!</p>

<pre><code>public class Welcome1 extends ListActivity
{


 protected TextView eun;
 protected SQLiteDatabase DB;
 protected Cursor cursor;
 protected ListAdapter adapter;
 protected TextView mUname;
 protected TextView mFname;
 protected TextView mLname;
 protected TextView mEmail;


  @Override
     public void onCreate(Bundle savedInstanceState) 
     {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.welcome1);


        DB = (new DBHelper(this)).getWritableDatabase();
        // searchText = (EditText) findViewById (R.id.searchText);

         eun = (TextView)findViewById(R.id.textV);
   Bundle bundle = getIntent().getExtras();

   String UName = bundle.getString("UserName");

   eun.setText(UName);



     }

  public void search(View view)
  {
   cursor = DB.rawQuery("SELECT _id, firstname, lastname, gender, username, email FROM JobSeeker WHERE username LIKE ?", 
     new String[] {"%" + eun.getText().toString() + "%"});
   adapter = new SimpleCursorAdapter(
     this,
     R.layout.dtl,
     cursor,
     new String[] {"firstname", "lastname", "gender","username", "email"},
     new int[] {R.id.sfname, R.id.slname, R.id.sgender , R.id.suname, R.id.semail});


   setListAdapter(adapter);
  }

  @Override
  public void onBackPressed() 
  {
   super.onBackPressed();
   Intent i = new Intent(Welcome1.this, LoginActivity.class);
   startActivity(i);
  }
  }
</code></pre>
