Android Open Source - Minesweeper Main Activity






From Project

Back to project page Minesweeper.

License

The source code is released under:

This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a co...

If you think the Android project Minesweeper listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.example.minesweeper;
//w  w w.ja va 2s  .  c  om
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

public class MainActivity extends Activity {

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);
  }

  public void gameAbout(View v) {
    Toast.makeText(getApplicationContext(), "Hello !", Toast.LENGTH_SHORT)
        .show();
    // String url = "http://www.thumbtack.com/challenges/software-engineer";
    // Intent in = new Intent(Intent.ACTION_VIEW);
    // in.setData(Uri.parse(url));
    // startActivity(in);
  }

  public void startGame(View v) {
    startActivity(new Intent(getBaseContext(), MinesweeperActivity.class));
  }

  public void gameInstructions(View v) {
    AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
    builder.setCancelable(true);
    builder.setTitle("Instructions");
    builder.setMessage(R.string.instructions);

    builder.setNeutralButton("Got it",
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
          }
        });
    builder.create().show();

  }

}




Java Source Code List

com.example.minesweeper.GameTile.java
com.example.minesweeper.MainActivity.java
com.example.minesweeper.MinesweeperActivity.java