user data

This commit is contained in:
Page Asgardius 2022-09-30 10:56:57 -07:00
parent 825617c2e6
commit f0b96f3b25
2 changed files with 35 additions and 1 deletions

View file

@ -29,7 +29,7 @@ public class MainScreen extends AppCompatActivity {
JSONObject jsonObj;
SQLiteDatabase db;
MyDbHelper dbHelper;
TextView id;
TextView id ,email, nacionalidad, nacimiento;
Button logout;
@Override
@ -38,6 +38,9 @@ public class MainScreen extends AppCompatActivity {
setContentView(R.layout.activity_main_screen);
username = getIntent().getStringExtra("username");
id = (TextView) findViewById(R.id.username);
email = (TextView) findViewById(R.id.email);
nacionalidad = (TextView) findViewById(R.id.nacionalidad);
nacimiento = (TextView) findViewById(R.id.nacimiento);
logout = (Button)findViewById(R.id.logout);
dbHelper = new MyDbHelper(this);
id.setText(username);
@ -81,6 +84,13 @@ public class MainScreen extends AppCompatActivity {
//Test
if (success) {
Toast.makeText(getApplicationContext(), "Credenciales correctas", Toast.LENGTH_SHORT).show();
try {
email.setText((String) jsonObj.getJSONArray("items").getJSONObject(0).getString("email"));
nacionalidad.setText((String) jsonObj.getJSONArray("items").getJSONObject(0).getString("country"));
nacimiento.setText((String) jsonObj.getJSONArray("items").getJSONObject(0).getString("birthdate"));
} catch (Exception e) {
e.printStackTrace();
}
} else {
Toast.makeText(getApplicationContext(), "Credenciales incorrectas", Toast.LENGTH_SHORT).show();

View file

@ -39,4 +39,28 @@
</LinearLayout>
<TextView
android:id="@+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="25sp" />
<TextView
android:id="@+id/nacionalidad"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="25sp" />
<TextView
android:id="@+id/nacimiento"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:textColor="@color/white"
android:textSize="25sp" />
</LinearLayout>