From d4f7160dc407010aaae59d9494ea184ccd73b787 Mon Sep 17 00:00:00 2001 From: Page Asgardius Date: Fri, 30 Sep 2022 09:32:14 -0700 Subject: [PATCH] working login method --- .../java/asgardius/page/r3forumtest/MainActivity.java | 1 + .../java/asgardius/page/r3forumtest/MainScreen.java | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/app/src/main/java/asgardius/page/r3forumtest/MainActivity.java b/app/src/main/java/asgardius/page/r3forumtest/MainActivity.java index eb04b36..be2381b 100644 --- a/app/src/main/java/asgardius/page/r3forumtest/MainActivity.java +++ b/app/src/main/java/asgardius/page/r3forumtest/MainActivity.java @@ -144,6 +144,7 @@ public class MainActivity extends AppCompatActivity { private void mainScreen (String username) { Intent intent = new Intent(this, MainScreen.class); + intent.putExtra("username", username); startActivity(intent); } diff --git a/app/src/main/java/asgardius/page/r3forumtest/MainScreen.java b/app/src/main/java/asgardius/page/r3forumtest/MainScreen.java index 8fe1f9e..1ecb52a 100644 --- a/app/src/main/java/asgardius/page/r3forumtest/MainScreen.java +++ b/app/src/main/java/asgardius/page/r3forumtest/MainScreen.java @@ -2,13 +2,23 @@ package asgardius.page.r3forumtest; import androidx.appcompat.app.AppCompatActivity; +import android.content.Intent; import android.os.Bundle; public class MainScreen extends AppCompatActivity { + String username; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main_screen); + username = getIntent().getStringExtra("username"); + } + + public void onBackPressed(){ + Intent a = new Intent(Intent.ACTION_MAIN); + a.addCategory(Intent.CATEGORY_HOME); + a.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(a); } } \ No newline at end of file