Android Open Source - Sudoku-Solver Sector Activity






From Project

Back to project page Sudoku-Solver.

License

The source code is released under:

Apache License

If you think the Android project Sudoku-Solver 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.awhittle.sudokusolver;
//  www . j av a 2 s .  c  o  m
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.app.Activity;
import android.content.Intent;

public class SectorActivity extends Activity {

  public static int a;
  public static int b;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sector);
    
    setButtonNum(0, 0, R.id.button1);
    setButtonNum(0, 1, R.id.button2);
    setButtonNum(0, 2, R.id.button3);
    setButtonNum(1, 0, R.id.button4);
    setButtonNum(1, 1, R.id.button5);
    setButtonNum(1, 2, R.id.button6);
    setButtonNum(2, 0, R.id.button7);
    setButtonNum(2, 1, R.id.button8);
    setButtonNum(2, 2, R.id.button9);
  }

  private void setButtonNum(int r, int c, int textViewID) {
    TextView tv = (TextView)findViewById(textViewID);
    
    int n = Grid.grid[Grid.row + r][Grid.col + c];
    
    if (n==0){
      tv.setText("x");
    } else {
      tv.setText(Integer.toString(n));
    }
  }
  
  public void gotoMain3(View v){
    Intent intent = new Intent(this, MainActivity.class);
    startActivity(intent);
  }

  private void setOffset(int i, int j){
    a = i;
    b = j;
  }
  
  public void gotoEdit1(View v){
    setOffset(0,0);
    Intent intent = new Intent(this, EditActivity.class);
    startActivity(intent);
  }
  
  public void gotoEdit2(View v){
    setOffset(0,1);
    Intent intent = new Intent(this, EditActivity.class);
    startActivity(intent);
  }
  
  public void gotoEdit3(View v){
    setOffset(0,2);
    Intent intent = new Intent(this, EditActivity.class);
    startActivity(intent);
  }
  
  public void gotoEdit4(View v){
    setOffset(1,0);
    Intent intent = new Intent(this, EditActivity.class);
    startActivity(intent);
  }
  
  public void gotoEdit5(View v){
    setOffset(1,1);
    Intent intent = new Intent(this, EditActivity.class);
    startActivity(intent);
  }
  
  public void gotoEdit6(View v){
    setOffset(1,2);
    Intent intent = new Intent(this, EditActivity.class);
    startActivity(intent);
  }
  
  public void gotoEdit7(View v){
    setOffset(2,0);
    Intent intent = new Intent(this, EditActivity.class);
    startActivity(intent);
  }
  
  public void gotoEdit8(View v){
    setOffset(2,1);
    Intent intent = new Intent(this, EditActivity.class);
    startActivity(intent);
  }
  
  public void gotoEdit9(View v){
    setOffset(2,2);
    Intent intent = new Intent(this, EditActivity.class);
    startActivity(intent);
  }

  
}




Java Source Code List

com.awhittle.sudokusolver.ClearActivity.java
com.awhittle.sudokusolver.DisplayActivity.java
com.awhittle.sudokusolver.EditActivity.java
com.awhittle.sudokusolver.Grid.java
com.awhittle.sudokusolver.MainActivity.java
com.awhittle.sudokusolver.SectorActivity.java
com.awhittle.sudokusolver.SolveActivity.java
com.awhittle.sudokusolver.Solve.java