Android Open Source - noughts-and-crosses-android Local High Score Activity






From Project

Back to project page noughts-and-crosses-android.

License

The source code is released under:

MIT License

If you think the Android project noughts-and-crosses-android 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.JamesWhite.NoughtsAndCrosses;
/*from   w w w.ja va  2s  . co m*/
/**
 * LocalHighScoreActivity Handles creating and setting up the ListView to hold the Local high scores
 * 
 * @author James White
 */

import android.app.ListActivity;
import android.database.Cursor;
import android.os.Bundle;
import android.widget.SimpleCursorAdapter;

public class LocalHighScoreActivity extends ListActivity {

  @Override
  public void onCreate(Bundle savedInstance) {

    super.onCreate(savedInstance);
    setContentView(R.layout.localhighscores);

    LocalDatabase localDatabase = new LocalDatabase(
        getApplicationContext(), "noughtsAndCrosses", null, 4);
    Cursor cursor = localDatabase.getScores();
    startManagingCursor(cursor);

    // Columns names from the db
    String[] columns = new String[] { "name", "score" };

    // the XML views in our layout that the data will be placed in
    int[] to = new int[] { R.id.highScoreName, R.id.highScoreInt };

    // create the adapter using the cursor
    SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
        R.layout.localhighscoreslistview, cursor, columns, to);

    this.setListAdapter(adapter);

    localDatabase.close();

  }

}




Java Source Code List

com.JamesWhite.NoughtsAndCrosses.AsyncSubmitGloabalHighScoresActivity.java
com.JamesWhite.NoughtsAndCrosses.ComputerPlayer.java
com.JamesWhite.NoughtsAndCrosses.Database.java
com.JamesWhite.NoughtsAndCrosses.GameActivity.java
com.JamesWhite.NoughtsAndCrosses.Game.java
com.JamesWhite.NoughtsAndCrosses.GlobalHighScoreActivity.java
com.JamesWhite.NoughtsAndCrosses.LoadingGloabalHighScoresActivity.java
com.JamesWhite.NoughtsAndCrosses.LocalDatabase.java
com.JamesWhite.NoughtsAndCrosses.LocalHighScoreActivity.java
com.JamesWhite.NoughtsAndCrosses.MenuActivity.java
com.JamesWhite.NoughtsAndCrosses.Player.java
com.JamesWhite.NoughtsAndCrosses.RemoteDatabase.java