• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Difficulty in fetching password from a specific row

AQSAANUM

Member
Jun 1, 2017
55
13
Hey friends,

I have written the code for fetching id and password from sqlite database. When I remove password fetching statement it works fine but if I write password fetching statement and run the app, that doesn't works for me.
Without password fetching this works fine, but I have to fetch password for confirming that an id is existing in SQLite database, here is the code,
please see and suggest.

Java:
 SQLiteDatabase db = dbHelper.getReadableDatabase();
        Student student = new Student();
        Cursor cursor = db.query(Student.TABLE, new String[] {Student.KEY_ID, Student.KEY_password}
                , Student.KEY_ID +  "=?",
                new String[] { id }, null, null, null, null);

        if (cursor.getCount() == 0){
            loginTest = false;
            }
        if (cursor.moveToFirst()){
            cursor.getString(cursor.getColumnIndex(Student.KEY_password));
          return true;

            }
        return loginTest;
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones