diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 199f105..c178e5b 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -10,7 +10,8 @@ android:supportsRtl="true" android:theme="@style/Theme.MemoCards"> - + diff --git a/app/src/main/java/com/example/memocards/Achievements.java b/app/src/main/java/com/example/memocards/Achievements.java index d1810a7..ae88e4c 100644 --- a/app/src/main/java/com/example/memocards/Achievements.java +++ b/app/src/main/java/com/example/memocards/Achievements.java @@ -2,13 +2,31 @@ import androidx.appcompat.app.AppCompatActivity; +import android.content.Intent; import android.os.Bundle; +import android.view.View; +import android.widget.Button; public class Achievements extends AppCompatActivity { + private Button backButton; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_achievements); + + this.backButton = this.findViewById(R.id.back_button); + + // When user click "Back" button. + this.backButton.setOnClickListener(new View.OnClickListener() { + + @Override + public void onClick(View view) { + // Back to main Activity. + Intent intent = new Intent (Achievements.this, MainActivity.class ); + startActivity(intent); + } + }); } } \ No newline at end of file diff --git a/app/src/main/java/com/example/memocards/MainActivity.java b/app/src/main/java/com/example/memocards/MainActivity.java index 7cc3d16..cecf335 100644 --- a/app/src/main/java/com/example/memocards/MainActivity.java +++ b/app/src/main/java/com/example/memocards/MainActivity.java @@ -10,6 +10,7 @@ public class MainActivity extends AppCompatActivity{ private Button play; + private Button achievments; @Override protected void onCreate(Bundle savedInstanceState) { @@ -24,6 +25,15 @@ public void onClick(View v) { } }); + achievments = findViewById(R.id.achievements); + achievments.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + Intent intent = new Intent(MainActivity.this, Achievements.class); + startActivity(intent); + } + }); + } diff --git a/app/src/main/res/layout/activity_achievements.xml b/app/src/main/res/layout/activity_achievements.xml index 4660f4a..074057a 100644 --- a/app/src/main/res/layout/activity_achievements.xml +++ b/app/src/main/res/layout/activity_achievements.xml @@ -6,4 +6,14 @@ android:layout_height="match_parent" tools:context=".Achievements"> +