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;
}
}