• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Help Android Studio, fetch specific database row on login and diplay it list view

Altair007

Lurker
I have an sqlite database that the user can register to! I have successfully created a login form and when the login is successful (username & password match the database's) the user is redirected to another activity. What I want is in the activity that the user is redirected, to diplay his entire database row (id,username, books,email,course, password, student name) in a list view or any other possible format !! Any ideas?? I would really appreciate if you could help me!!! Thanks in advance

This the code that creates 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); ";

This is the code that stores a user in 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("USERNAME", userName);
newValues.put("PASSWORD",password);
newValues.put("COURSE", course);
newValues.put("EMAIL",email);
newValues.put("STUDENT_NAME", student_name);

// Insert the row into your table
db.insert("LOGIN", null, newValues);
///Toast.makeText(context, "Reminder Is Successfully Saved", Toast.LENGTH_LONG).show();
}

And this 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();
}
 
Back
Top Bottom