简体   繁体   中英

Method is undefined?

When I write the code below, it says that the method getReadableDatabase() is undefined for dbHelper , what is the problem with it?

public void checklogin(String logged){


    DatabaseAdapter dbHelper = new DatabaseAdapter(LoginActivity.this);

    db = dbHelper.getReadableDatabase();


    Cursor mCursor = db.query(dbHelper.TABLE_USERS,new String[]{"select * from users"}, " Name like" + "'logged+'",null,null,null,null);

     if  (mCursor.moveToFirst()){
         Toast.makeText(LoginActivity.this, "Yaaaay", Toast.LENGTH_LONG).show();
     }

      Toast.makeText(LoginActivity.this, "invalid", Toast.LENGTH_LONG).show();


        }
}

What's your implementation of DatabaseAdapter ? It's not part of the Android framework. The only class that I know of that implements getReadableDatabase() is SQLiteOpenHelper .

这通常意味着getReadableDatabase()不是您的DatabaseAdapter类中的函数。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM