public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { Map<String, String> metric = (Map<String, String>) getListAdapter().getItem(arg2); BurnBot.LogD("Metric: " + metric.get("Name") + " selected."); Intent intent = new Intent(BodyMetricsListActivity.this, BodyEntryListActivity.class); intent.putExtra("body_metric_identifier", metric.get("Identifier")); intent.putExtra("body_metric_unit", metric.get("Unit")); FlurryAgent.onEvent("Click Body Metric List Item", metric); startActivity(intent); }
@Override protected List<Map<String, String>> doInBackground(Void... unused) { User userInfo = userDao.getUserInfo(); List<BodyMetric> metrics = bodyDao.getBodyMetrics(); List<Map<String, String>> mapping = new ArrayList<Map<String, String>>(); for (BodyMetric metric : metrics) { BurnBot.LogD("Metric " + metric.getName() + ", Pro: " + metric.isPro()); if (!metric.isPro() || userInfo.isPro()) { BurnBot.LogD("Adding " + metric.getName()); HashMap<String, String> map = new HashMap<String, String>(); map.put("Name", metric.getName()); map.put("Pro", String.valueOf(metric.isPro())); map.put("ID", String.valueOf(metric.getId())); map.put("Identifier", metric.getMetricIdentifier()); map.put("Unit", metric.getUnit()); mapping.add(map); } } return mapping; }