I have a sqlite database that the user can register to! I have successfully created a login form and when the login is successful (database’s username and password match what the user has entered on the form) the user is redirected to another activity. What i want is in the activity that the user is redirected,
to display his entire database row (id,username, books,email,course, password, student name) based on his username or id!! Any ideas?? I would really appreciate if you could help me…This is urgent!!!
Here is my code for creating the database:
static final String DATABASE_CREATE = "create table "+"LOGIN"+
"( " +"ID"+" integer primary key autoincrement,"+ "USERNAME varchar2," +
"PASSWORD varchar2, COURSE varchar2, EMAIL varchar2, STUDENT_NAME varchar2); ";
Here is the code for storing users to the database:
public void insertEntry(String userName,String password,String course,String email, String student_name)
{
ContentValues newValues = new ContentValues();
// Assign values for each row.
newValues.put("USERNAMEerName);
newValues.put("PASSWORD",password
newValues.put("COURSEurse);
newValues.put("EMAIL",email
newValues.put("STUDENT_NAMEudent_name);
// Insert the row into your table
db.insert("LOGIN", null, newValues);
///Toast.makeText(context, "Reminder Is Successfully Saved", Toast.LENGTH_LONG).show();
}
and finally here is the login code:
if(password.equals(storedPassword))
{
Toast.makeText(MyActivity.this, "Congrats: Login Successfull", Toast.LENGTH_LONG).show();
dialog.dismiss();
startActivity(new Intent(MyActivity.this, Login_home.class));
}
else
{
Toast.makeText(MyActivity.this, "User Name or Password does not match", Toast.LENGTH_LONG).show();
}
Can you please provide me with the class that does what I’m after??? I’ve checked everything and this is really important!! Thanks in advance!!