I am new to Android and trying to understand how a user can be identified as his own data when he retrieves a List view of his for example To Do list.
At the moment I currently have 1. Register 2. Login, checks the database if username and pass equals to his input 3. Add a ToDo note onto the SQL? 4. Retrieve the ToDo note once added uniquely to him?
How can I do this? Currently I only have 1 table which are the users and will be making multiple tables.
Login
boolean loggedIn = false;
SharedPreferences pre;
static public Context context;
public void onClick(View v) {
Controller handler = new Controller(getBaseContext());
handler.open();
if (username.equals("") || password.equals("")) {
Toast.makeText(getApplicationContext(), "Please fill in all fields", Toast.LENGTH_SHORT).show();
return;
}
if (handler.executeLog(username, password)) {
Toast.makeText(this, "Successfully Logged In", Toast.LENGTH_LONG).show();
Intent log = new Intent(this, MainActivity.class);
pre.edit().putBoolean("LoggedIn",true).putString("username", username).putString("password", password).commit();
startActivity(log);
handler.close();
} else {
Toast.makeText(this, "Invalid Username/Password", Toast.LENGTH_SHORT).show();
}
DBControl.java this is where all my rawQuery are executed.What methods do I add?
Aucun commentaire:
Enregistrer un commentaire