Back to project page pokedex.
The source code is released under:
MIT License
If you think the Android project pokedex listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.andrescanales.pokedex; //from w w w .j a v a 2 s . c o m import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.ActivityInfo; import android.os.Bundle; import android.preference.PreferenceManager; import android.support.v7.app.ActionBarActivity; import android.view.Menu; import android.view.MenuItem; public class MainActivity extends ActionBarActivity implements PokemonListFragment.Callbacks{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() // So far the only change in this class is referencing to the PokemonListFragment .add(R.id.container, new PokemonListFragment()) .commit(); } } @Override public void onItemSelected(Pokemon pokemon) { Intent detailIntent = new Intent(this, PokemonDetail.class); //detailIntent.putExtra("nombre", nombre); detailIntent.putExtra("pokemon", pokemon); startActivity(detailIntent); } @Override public void onResume() { super.onResume(); // Always call the superclass method first SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this); String unitType = sharedPrefs.getString( getString(R.string.pref_rotation_key), getString(R.string.pref_rotation_label_default)); if (unitType.equals(getString(R.string.pref_rotation_label_landscape))) { this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); // Log.i("MainActivity", "MyClass.getView() Entering to Landscape"); } else if (unitType.equals(getString(R.string.pref_rotation_label_portrait))) { this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); // Log.i("MainActivity", "MyClass.getView() Entering to Portrait"); } else { } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { startActivity(new Intent(this, SettingsActivity.class)); return true; } return super.onOptionsItemSelected(item); } /** * A placeholder fragment containing a simple view. */ }