@Override protected void onStart() { super.onStart(); // tradeListController.updateTradeList(); tradeIDs = tradeListController.getIds(tradeListController.getTradesOfType(type)); tradeNames = tradeListController.getNames(tradeListController.getTradesOfType(type)); ArrayAdapter<String> adapter = new ArrayAdapter<String>( TradesLogTypeActivity.this, android.R.layout.simple_list_item_1, tradeNames); ListView listView = (ListView) findViewById(R.id.listView_trades_log); listView.setAdapter(adapter); listView.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // if click on the listview item, show the image on a new activity Intent i = new Intent(TradesLogTypeActivity.this, TradeDetailActivity.class); i.putExtra("type", type); i.putExtra("position", position); i.putExtra("id", tradeIDs.get(position)); startActivity(i); } }); }
@Override protected void onResume() { super.onResume(); myTradeListController.updateTradeList(); tradeRequestNames = myTradeListController.getNames(myTradeListController.getTradeRequests()); ArrayAdapter<String> adapter = new ArrayAdapter<>( TradeRequestsActivity.this, android.R.layout.simple_list_item_1, tradeRequestNames); ListView listView = (ListView) findViewById(R.id.listView_trade_requests); listView.setAdapter(adapter); listView.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // if click on the listview item, show the image on a new activity Intent i = new Intent(TradeRequestsActivity.this, TradeRequestDetailActivity.class); i.putExtra("Position", position); startActivity(i); } }); }