2月9日学习日志

今天学习了sqllite数据库存储。

SQLiteDatabase db=dbOpenHelper.getReadableDatabase();
String Id=EditTextLoginId.getText().toString();
String pwd=EditTextLoginPassword.getText().toString();
Cursor cursor = db.rawQuery("select * from user",null);
while (cursor.moveToNext()) {
String searchName = cursor.getString(cursor.getColumnIndex("id"));
String searchAge = cursor.getString(cursor.getColumnIndex("password"));
if(searchName.equals(Id)&&searchAge.equals(pwd)){
Intent intent=new Intent(MainActivity.this, RegisterActivity.class);
startActivity(intent);
break;
}
}
posted @ 2021-02-09 11:52  张笑天  阅读(16)  评论(0编辑  收藏  举报