@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.userId = getIntent().getExtras().getInt("userid", 0); this.position = getIntent().getExtras().getInt("id", 0); if (userId > 0) { checkinModel.loadCheckinByUser(userId); } else { checkinModel.load(); } // because of header view, decrease position by one initCheckin(this.position); fetchComments(); }
private void initCheckin(int position) { listCheckin = checkinModel.getCheckins(this); if (listCheckin != null) { checkinId = (int) listCheckin.get(position).getCheckinId(); if (view != null) { view.setTitle(listCheckin.get(position).getUsername()); view.setBody(listCheckin.get(position).getMessage()); view.setDate(listCheckin.get(position).getDate()); view.setListPhotos((int) checkinId); view.setListComments(checkinId); view.getListPhotos() .setOnClickListener( new OnClickListener() { public void onClick(View v) { Intent i = new Intent(ViewCheckinActivity.this, ViewReportPhotoActivity.class); i.putExtra("reportid", checkinId); i.putExtra("position", 0); startActivityForResult(i, 0); overridePendingTransition(R.anim.home_enter, R.anim.home_exit); } }); view.setListComments((int) checkinId); view.getListComments() .setOnItemClickListener( new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View v, int pos, long id) { Intent i = new Intent(ViewCheckinActivity.this, ListCheckinCommentActivity.class); i.putExtra("checkinid", checkinId); i.putExtra("position", pos); startActivityForResult(i, 0); overridePendingTransition(R.anim.home_enter, R.anim.home_exit); } }); centerLocationWithMarker( getPoint( Double.parseDouble(listCheckin.get(position).getLocationLatitude()), Double.parseDouble(listCheckin.get(position).getLocationLongitude()))); view.mapView.setBuiltInZoomControls(false); int page = position; this.setTitle(page + 1); } } }