Android Open Source - SCBIO-OneButtonLarry Highscore Activity






From Project

Back to project page SCBIO-OneButtonLarry.

License

The source code is released under:

MIT License

If you think the Android project SCBIO-OneButtonLarry 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 org.scbio.onebuttonlarry;
//from  www. java  2 s . c  o  m
import java.util.ArrayList;

import android.app.ListActivity;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class HighscoreActivity extends ListActivity {

  private static LayoutInflater inflater = null;
  private ArrayList<Highscore> mList;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    
    inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    mList = HighscoreManager.loadHighscores(getBaseContext());
    
    setListAdapter(new HighscoreListAdapter());
  }
  

  @Override
  protected void onResume() {
    super.onResume();
    MusicManager.resume();
  }
  
  private class HighscoreListAdapter extends BaseAdapter{
      
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
        View vi=convertView;
        if(convertView==null)
          vi = inflater.inflate(R.layout.row_highscore, null);

        TextView player = (TextView) vi.findViewById(R.id.rowplayerTextView);
        TextView score = (TextView) vi.findViewById(R.id.rowscoreTextView);        
        Highscore rowData = mList.get(position);

        // Setting all values in listview
        player.setText(rowData.getPlayer());
        score.setText(String.valueOf(rowData.getScore()));
        return vi;
      }

      @Override
      public long getItemId(int position) {
        return position;
      }

      @Override
      public Object getItem(int position) {
        return mList.get(position);
      }

      @Override
      public int getCount() {
        return mList.size();
      }
  }


}




Java Source Code List

org.scbio.onebuttonlarry.AboutActivity.java
org.scbio.onebuttonlarry.GameActivity.java
org.scbio.onebuttonlarry.HighscoreActivity.java
org.scbio.onebuttonlarry.HighscoreManager.java
org.scbio.onebuttonlarry.Highscore.java
org.scbio.onebuttonlarry.MainActivity.java
org.scbio.onebuttonlarry.MusicManager.java
org.scbio.onebuttonlarry.PreferencesManager.java
org.scbio.onebuttonlarry.ResultActivity.java
org.scbio.onebuttonlarry.game.GameStage.java
org.scbio.onebuttonlarry.game.GameView.java
org.scbio.onebuttonlarry.game.Larry.java
org.scbio.onebuttonlarry.game.Sprite.java
org.scbio.onebuttonlarry.stage.GapJumpStage.java
org.scbio.onebuttonlarry.stage.PlatformsStage.java
org.scbio.onebuttonlarry.stage.RockStage.java
org.scbio.onebuttonlarry.stage.RunStopStage.java