private void showSectorNotes() { Intent intent = new Intent(this, SectorNotesActivity.class); intent.putExtra("system", currentSector.getSystem()); intent.putExtra("alpha", currentSector.getAplhaCoord()); intent.putExtra("num", currentSector.getNumCoord()); startActivity(intent); }
@Override public void onPause() { super.onPause(); // Save the needed preferences SharedPreferences.Editor editor = getSharedPreferences(PREFS_NAME, 0).edit(); // Load the selected items Sector selected = getSelectedSector(); // Dump them all into the right places and save editor.putString(PREF_LAST_SYSTEM, selected.getSystem()); editor.putString(PREF_LAST_SECTOR_APLHA, selected.getAplhaCoord()); editor.putString(PREF_LAST_SECTOR_NUM, selected.getNumCoord()); editor.commit(); data.close(); }
private void setMineralLists(Sector sector) { // Populate the list with the initial data // Remove the ones we don't want mineralList.clear(); mineralList.addAll(Static.mineralList); // Grab the ore list for later ArrayAdapter<String> oreListAdapter = new ArrayAdapter<String>( this, android.R.layout.simple_list_item_1, new ArrayList<String>()); ((ListView) findViewById(R.id.oreList)).setAdapter(oreListAdapter); // Add and remove the needed things from the lists for (Mineral mineral : sector.getMinerals()) { mineralList.remove(mineral.getMineral()); oreListAdapter.add(mineral.getMineral()); } // Check to see if the mineral list is empty. If so add the emtpy mineral if (mineralList.size() == 0) mineralList.add(emptyMineralString); mineralAdapter.notifyDataSetChanged(); oreListAdapter.notifyDataSetChanged(); }