Advertisement
mmayoub

NumbersPuzle, WellcomeActivity.java, 09.10.2021

Oct 10th, 2021
1,075
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.06 KB | None | 0 0
  1. package com.example.mynumberspuzzle;
  2.  
  3. import android.content.Intent;
  4. import android.os.Bundle;
  5. import android.view.View;
  6.  
  7. import androidx.appcompat.app.AppCompatActivity;
  8.  
  9. public class WellcomeActivity extends AppCompatActivity {
  10.  
  11.     @Override
  12.     protected void onCreate(Bundle savedInstanceState) {
  13.         super.onCreate(savedInstanceState);
  14.         setContentView(R.layout.activity_wellcome);
  15.     }
  16.  
  17.     public void startGame(View view) {
  18.         int rows = 4;
  19.         int cols = 4;
  20.  
  21.         switch (view.getId()) {
  22.             case R.id.btnEasy:
  23.                 rows = 3;
  24.                 cols = 3;
  25.                 break;
  26.  
  27.             case R.id.btnMedium:
  28.                 rows = 4;
  29.                 cols = 4;
  30.                 break;
  31.  
  32.             case R.id.btnHard:
  33.                 rows = 5;
  34.                 cols = 5;
  35.                 break;
  36.         }
  37.  
  38.         Intent intent = new Intent(this, MainActivity.class);
  39.         intent.putExtra("ROWS_COUNT", rows);
  40.         intent.putExtra("COLS_COUNT", cols);
  41.         startActivity(intent);
  42.  
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement