Android Open Source - SudokuSolver Main Tab Activity






From Project

Back to project page SudokuSolver.

License

The source code is released under:

License JSON Sudoku Solver is covered under the Creative Commons Attribution 3.0 Unported License http://creativecommons.org/licenses/by/3.0/ Credits Sudoku Solver Java implementation: Kevin Coulombe...

If you think the Android project SudokuSolver 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

/**
 * JSON Sudoku solver is covered under the Creative Commons Attribution 3.0 Unported License
 * http://creativecommons.org/licenses/by/3.0/
 * /*from  w ww  .j  a  va  2s  .  co  m*/
 * @author www.androidcookers.co.cc
 * {@link www.androidcookers.co.cc}
 */
package com.musevisions.android.SudokuSolver;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TabHost;
import android.widget.TextView;

public class MainTabActivity extends TabActivity {
  
  SudokuLoaderActivity mLoaderActivity;
  SudokuSolverActivity mSolverActivity;
  
  /** Called when the activity is first created. */  
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.main);
    setTabs() ;
  }
  
  public void setLoaderActivity(SudokuLoaderActivity activity) {
    mLoaderActivity = activity;
  }
  public void setSolverActivity(SudokuSolverActivity activity) {
    mSolverActivity = activity;  
  }
  
  public SudokuSolverActivity getSolverActivity() {
    return mSolverActivity;
  }
  
  private void setTabs()
  {
    addTab("Game", R.drawable.tab_home, SudokuSolverActivity.class);
    addTab("Load", R.drawable.tab_search, SudokuLoaderActivity.class);

    //To add more tabs just use addTab() method here like previous line.
  }
  
  private void addTab(String labelId, int drawableId, Class<?> c)
  {
    TabHost tabHost = getTabHost();
    Intent intent = new Intent(this, c);
    TabHost.TabSpec spec = tabHost.newTabSpec("tab" + labelId);  
    
    View tabIndicator = LayoutInflater.from(this).inflate(R.layout.tab_indicator, getTabWidget(), false);
    TextView title = (TextView) tabIndicator.findViewById(R.id.title);
    title.setText(labelId);
    ImageView icon = (ImageView) tabIndicator.findViewById(R.id.icon);
    icon.setImageResource(drawableId);
    
    spec.setIndicator(tabIndicator);
    spec.setContent(intent);
    tabHost.addTab(spec);
  }
}




Java Source Code List

com.musevisions.android.SudokuSolver.CustomDialogs.java
com.musevisions.android.SudokuSolver.GridView.java
com.musevisions.android.SudokuSolver.HttpPostUtils.java
com.musevisions.android.SudokuSolver.JSONHelper.java
com.musevisions.android.SudokuSolver.MainTabActivity.java
com.musevisions.android.SudokuSolver.StoreHelper.java
com.musevisions.android.SudokuSolver.SudokuCore.java
com.musevisions.android.SudokuSolver.SudokuLoaderActivity.java
com.musevisions.android.SudokuSolver.SudokuRetrieverTask.java
com.musevisions.android.SudokuSolver.SudokuRetriever.java
com.musevisions.android.SudokuSolver.SudokuSolverActivity.java
com.musevisions.android.SudokuSolver.SudokuSolverBruteForce.java
com.musevisions.android.SudokuSolver.SudokuSolverOptimised.java
com.musevisions.android.SudokuSolver.SudokuSolverTask.java