SQLiteDatabase db = this.getReadableDatabase();
Cursor mCursor =db.query(TABLE_ACCOUNTS, new String[]{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s}, null,null, null, null, null);
My question is:
Will this initialization allow to return ALL values in the db database & table?
As far as my project, it appears to only be returning NULL values. (No Error)
a = null,b = null,c = null
Detected some actual values when i manipulated with the 3rd parameter with a+”=?” and variations (which is now null).
Or could the prevention of actual values be something else? (assuming Adding Data to the DB works)
(Adding code)
public void addAccount() {
SQLiteDatabase db = this.getWritableDatabase();
Account account = new Account();
ContentValues values = new ContentValues();
values.put(id, account.getA()); // Contact Name
values.put(a, account.getA()); // Contact Phone Number
values.put(b, account.getB()); // Contact Phone Number
values.put(c, account.getC());
...
db.insert(TABLE_ACCOUNTS, null, values);
db.close(); // Closing database connection
}
(Cursor code)
if ( (mCursor != null && mCursor.moveToFirst()) ) {
do {
stringResult1 =
"a: "+ mCursor.getString(0)+ "\n"
+ "b: " + mCursor.getString(1) + "\n"
+ "c: " + mCursor.getString(2) + "\n"
+ "d: " + mCursor.getString(3) + "\n"
+ "e: " + mCursor.getString(4) + "\n"
+ "f: " + mCursor.getString(5) + "\n"
+ "g: " + mCursor.getString(6) + "\n"
+ "h: " + mCursor.getString(7) + "\n"
+ "i " + mCursor.getString(8) + "\n"
+ "j: " + mCursor.getString(9) + "\n"
+ "k: " + mCursor.getString(10) + "\n"
+ "l: " + mCursor.getString(11) + "\n"
+ "m: " + mCursor.getString(12) + "\n"
+ "n: " + mCursor.getString(13) + "\n"
+ "o: " + mCursor.getString(14) + "\n"
+ "p: " + mCursor.getString(15) + "\n"
+ "q: " + mCursor.getString(16) + "\n"
+ "r: " + mCursor.getString(17) + "\n"
+ "s: " + mCursor.getString(18) + "\n";
} while (mCursor.moveToNext());
// make sure to close the cursor
mCursor.close();
}
Regarding above query.. the second parameter ie a String array is projection parameter means the columns that you want to be fetched in from db and fill it in cursor.
since if in the query the value of a,b,c,d,e… variables could be different that that of columns in db so there are no values exists in cursor for the requested column.
Hope that helps ! Thanks