I have a project in Android Studio with a SQLite bd, what I need is that when logging into the LoginActivity it shows me certain data from other tables that correspond to the logged in user.
This is my method when logging in, what I need is that when I ask my queries to other tables in the other Activitys, I should make a comparison with the id of the logged in user in LoginActivity
.
String usua, pass, idg;
bd=con.getReadableDatabase();
String query="Select id, UserName, Pwd from " + utilidades.Tpersonas +"
where UserName= '"+_edtUser.getText().toString()+"'";
Cursor cursor=bd.rawQuery(query, null);
if(cursor !=null)
{
if (cursor.moveToFirst() == true) {
do {
idg = cursor.getString(cursor.getColumnIndex(utilidades.id));
usua = cursor.getString(cursor.getColumnIndex(utilidades.UserName));
pass = cursor.getString(cursor.getColumnIndex(utilidades.Pwd));
if((_edtUser.getText().toString()).equals(usua))
{
pass = _edtPassword.getText().toString();
}
}while(cursor.moveToNext());
}
}
cursor.close();
onLoginSuccess();
}
public void onLoginSuccess(){
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
}