Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Cannot make a static reference to the non-static method getReadableDatabase() from the type SQLiteOpenHelper
- public static boolean vaidateUser(String username, String password) {
- Cursor c = getReadableDatabase().rawQuery(
- "SELECT * FROM " + TABLE_NAME_CREDENTIALS + " WHERE "
- + COLUMN_NAME_USERNAME + "='" + username +"'AND "+COLUMN_NAME_PASSWORD+"='"+password+"'" , null);
- if (c.getCount()>0)
- return true;
- return false;
- lsLogin.setOnClickListener (new OnClickListener() {
- @Override
- public void onClick(View v) {
- //check login
- String username = lsUsername.getText().toString();
- String password = lsPassword.getText().toString();
- try{
- if(LoginDB.vaidateUser(username,password)) {
- Intent goToNextActivity = new Intent(getApplicationContext(), menu.class);
- startActivity(goToNextActivity);
- Toast.makeText(LoginScrExample.this,"Login Sucessful",Toast.LENGTH_LONG).show();
- }else{
- Toast.makeText(LoginScrExample.this,"Invalid Username/Password",Toast.LENGTH_LONG).show();
- }
- }
- getReadableDatabase();
- Cursor c = new SQLiteOpenHelper().getReadableDatabase()..
- SQLiteOpenHelper soh = new SQLiteOpenHelper();
- Cursor c = soh().getReadableDatabase()..
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement