Back to project page android-simlple-minefield.
The source code is released under:
Apache License
If you think the Android project android-simlple-minefield listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.trabo.minefield; /*from w w w . j av a 2 s . c o m*/ import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import com.trabo.minefield.utils.AppContract; /** * @author Andriy Petruk <andrii.petruk{at}gmail.com> * @date 23.06.14. */ public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_activity); findViewById(R.id.easy_game_button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startGame(AppContract.GameType.EASY); } }); findViewById(R.id.normal_game_button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startGame(AppContract.GameType.NORMAL); } }); findViewById(R.id.hard_game_button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startGame(AppContract.GameType.HARD); } }); findViewById(R.id.high_score_button).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(MainActivity.this, HighScoresActivity.class)); } }); } private void startGame(AppContract.GameType gameType) { Intent intent = new Intent(MainActivity.this, GameActivity.class); intent.putExtra(GameActivity.GAME_TYPE_KEY, gameType.ordinal()); startActivity(intent); } }