Hi I'm new to android programming, and i don't know or i really can't figure out why do i get this error message after i click the button on the app that i created
java.lang.NullPointerException at com.example.dailydoseofhappiness.MainActivity.searchRecord(MainActivity.java:62) at com.example.dailydoseofhappiness.MainActivity.searchRecord(MainActivity.java:52)
here is the code fragment.
public void onClick(View arg){
if(arg.getId()==R.id.btnfortune){ //this is line 52
searchRecord(count);
}
}
public void searchRecord(int count)
throws SQLException
{
Cursor rsCursor;
String [] rsFields = {"mesNum","Message"}; // this is line 62
rsCursor = dbm.dbase.query("MessageFile", rsFields, "mesNum = " + count, null, null, null, null, null);
rsCursor.moveToFirst();
if(rsCursor.isAfterLast()==false){
lblmessageS.setText(rsCursor.getString(0));
}
rsCursor.close();
}
can anyone check this code fragment if whats wrong thank you very much