I am receiving values from other activities and with these values try to fetch the data from the database but NullPointerException will occur
final Bundle bundle=this.getIntent().getExtras();
String topic=bundle.getString("topic");
String subtopic=bundle.getString("subtopic");
My Database Query is
public Cursor getAll() {
return (getReadableDatabase().query("Q_A", new String[] { "_id",
"Question","QLevel", "TopicId", "SubTopicId" }, "TopicId=? AND SubTopicId=?",
new String[] { topic + "", subtopic + "" }, null, null,
null));
}
If mu guess is correct you are sending intent datatype as Integer from previous activity and receiving as String in Current Activity.
Ensure that you send String type and getting String type.
Change your code to :