简体   繁体   English

方法未定义?

[英]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? 当我写下面的代码,它说,该方法getReadableDatabase()是未定义dbHelper ,什么是它的问题?

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 ? 您对DatabaseAdapter的实现是什么? It's not part of the Android framework. 它不是Android框架的一部分。 The only class that I know of that implements getReadableDatabase() is SQLiteOpenHelper . 我知道的唯一实现getReadableDatabase()SQLiteOpenHelper

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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