This is my method in DBMethods class:
public void getResult(EditText keyWord2){
EditText keyWord = null;
String SQL ="localSearch.php?query="+keyWord.getText();
mDb.rawQuery(SQL, null);
}
And this is my method in which I am opening Database and all that in webServices class.
public void startSearch(View v){
keyWord = (EditText)findViewById(R.id.searchField);
String data = null;
DBMethods mDbHelper = new DBMethods(this);
mDbHelper.createDatabase();
mDbHelper.open();
mDbHelper.getResult(keyWord);
mDbHelper.close();
}
When I try to fetch data from the database by entering some keyword in the search bar, a force close error occurs.
EditText keyWord = null;
Keyword is null, this will give null pointer exception.
I think your SQL variable must be