@Override public boolean onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); menu.findItem(R.id.home_button).setVisible(false); return true; }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.list_bg_with_filter); adapter = new ArrayAdapter<String>( this, R.layout.list_item, FINHome.getBuildingsList(getBaseContext())); filterText = (EditText) findViewById(R.id.search_box); filterText.addTextChangedListener(filterTextWatcher); setListAdapter(adapter); ListView lv = getListView(); lv.setTextFilterEnabled(true); // Every item will launch the map lv.setOnItemClickListener( new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View v, int position, long id) { final String selectedBuilding = ((TextView) v).getText().toString(); myDialog = ProgressDialog.show( BuildingList.this, "", "Loading " + selectedBuilding + "...", true); Thread buildingThread = new Thread() { @Override public void run() { Intent myIntent = new Intent(getBaseContext(), FINMap.class); myIntent.putExtra("building", selectedBuilding); myIntent.putExtra("category", ""); startActivity(myIntent); myDialog.dismiss(); } }; buildingThread.start(); } }); }
@Override protected void onDestroy() { super.onDestroy(); filterText.removeTextChangedListener(filterTextWatcher); }