Android Open Source - ARGiE Game Chooser Activity






From Project

Back to project page ARGiE.

License

The source code is released under:

MIT License

If you think the Android project ARGiE 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 headrick.brandon.activities;
//from   w w w .ja v a  2s.  c  o  m
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import headrick.brandon.R;

/**
 * Provides the interface for the user to choose which already created game
 * to execute.
 * @author Brandon Headrick
 *
 */
public class GameChooserActivity extends Activity
{
  
    @Override
    protected void onCreate(Bundle savedInstanceState) 
    {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.game_chooser_screen);

      final ListView listview = (ListView) findViewById(R.id.listview);
      /*
      String[] values = new String[] { "Android", "iPhone", "WindowsMobile",
          "Blackberry", "WebOS", "Ubuntu", "Windows7", "Max OS X",
          "Linux", "OS/2", "Ubuntu", "Windows7", "Max OS X", "Linux",
          "OS/2", "Ubuntu", "Windows7", "Max OS X", "Linux", "OS/2",
          "Android", "iPhone", "WindowsMobile" };
      */
      
      String[] values = new String[]{"Waypoint"};

      final ArrayList<String> list = new ArrayList<String>();
      for (int i = 0; i < values.length; ++i)
      {
        list.add(values[i]);
      }
      final StableArrayAdapter adapter = new StableArrayAdapter(this,
          android.R.layout.simple_list_item_1, list);
      listview.setAdapter(adapter);

      listview.setOnItemClickListener(new AdapterView.OnItemClickListener() 
      {

        @Override
        public void onItemClick(AdapterView<?> parent, final View view, int position, long id) 
        {
          //final String item = (String) parent.getItemAtPosition(position);
          //for now, just go play the preloaded game.
          
        }

      });
    }//end oncreate

    
    private class StableArrayAdapter extends ArrayAdapter<String> 
    {

      HashMap<String, Integer> mIdMap = new HashMap<String, Integer>();

      public StableArrayAdapter(Context context, int textViewResourceId,
          List<String> listValues) 
      {
        super(context, textViewResourceId, listValues);
        for (int i = 0; i < listValues.size(); ++i) 
        {
          mIdMap.put(listValues.get(i), i);
        }
      }

      @Override
      public long getItemId(int position) 
      {
        String item = getItem(position);
        return mIdMap.get(item);
      }

      @Override
      public boolean hasStableIds() 
      {
        return true;
      }

    }
    

}




Java Source Code List

android.UnusedStub.java
headrick.brandon.activities.AboutScreenActivity.java
headrick.brandon.activities.CreateGameActivity.java
headrick.brandon.activities.EditQuestActivity.java
headrick.brandon.activities.GameChooserActivity.java
headrick.brandon.activities.GameOptionsActivity.java
headrick.brandon.activities.RunGameActivity.java
headrick.brandon.activities.SettingsActivity.java
headrick.brandon.activities.SplashActivity.java
headrick.brandon.activities.TitleScreenActivity.java
headrick.brandon.gamedata.Constants.java
headrick.brandon.gamedata.GameSettingsState.java
headrick.brandon.gamedata.GameState.java
headrick.brandon.models.BaseGame.java
headrick.brandon.models.QuestNode.java
headrick.brandon.models.WaypointGame.java
headrick.brandon.utilities.DBReadWrite.java
headrick.brandon.utilities.DBTest.java
headrick.brandon.utilities.DatabaseHandler.java
headrick.brandon.utilities.MapHelper.java