Below i have written the code for Login Authentication, this code will check that weather the entered name and password are there in database or not.
The following code will return true boolean value if the entered name and password exist in database and will return false boolean value if not.
public boolean login(String username, String password)throws SQLException
{
SQLiteDatabase db=this.getWritableDatabase();
Cursor cursor= db.rawQuery("Select * from "+TABLE2_NAME+" where email=? AND email_type=?",new String[]{username,password});
if(cursor!=null)
{
if(cursor.getCount()>0)
{
return true;
}
}
return false;
}
0 Comment(s)