Displaying SQLite data in textview returning null

2019-03-05 02:44发布

问题:

MainData myDBHlpr = new MainData(getActivity()); 

Cursor csr = myDBHlpr.getAllQuestions(UsageSettings.this);
while (csr.moveToFirst()) {
    mMostMessagesSent.setText(csr.getString(csr.getColumnIndex("Reviews")));
    mMostMessagesSent.setTextColor(Color.WHITE);
}

I checked row count and it showed 16

Then i checked

Log.d("TAG", csr.getString(cst.getColumnIndex("Reviews"))); 

And it showed error saying Log needs a message(Which means its null)

But why is it showing null even when the table has 16rows and column name exists

HELPER METHOD

public Cursor getAllQuestions(UsageSettings usageSettings) {

    return this.getWritableDatabase().query(TABLE_NAME,null,null,null,null,null,null);
}