@Override public void bindView(View view, Context context, Cursor cursor) { super.bindView(view, context, cursor); TextView setup = (TextView) view.findViewById(R.id.text3); TextView reply = (TextView) view.findViewById(R.id.text4); locationCursor.moveToPosition(cursor.getPosition()); long rt = locationCursor.getLong(1); if (rt > 0) { Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(rt); DateFormat sdf = SimpleDateFormat.getDateTimeInstance(); setup.setText("requested on: " + sdf.format(cal.getTime())); } else { setup.setText("requested on: <not available>"); } rt = locationCursor.getLong(2); if (rt > 0) { Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(rt); DateFormat sdf = SimpleDateFormat.getDateTimeInstance(); reply.setText("updated on:" + sdf.format(cal.getTime())); ((ImageView) view.findViewById(R.id.status)) .setImageResource(android.R.drawable.presence_online); } else { reply.setText("updated on: <not available>"); } }
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { // getting a null pointer exception here Log.d(TAG, "Content loaded: " + cursor.getCount()); listAdapter.swapCursor(cursor); }
void showDetails(int pos) { Cursor c = (Cursor) listAdapter.getItem(pos); showDetails( ContactContract.OBJECT_CONTACT_URI .buildUpon() .appendPath(c.getString(c.getColumnIndex(ContactContract.Columns._ID))) .build()); }
void resolveConflict(int pos) { if (BuildConfig.DEBUG) { Log.d(TAG, "resolve conflicts"); } Cursor c = (Cursor) listAdapter.getItem(pos); int di = c.getColumnIndex(WebData.Object.WD_DATA_ID); String dataID = c.getString(di); resolveConflict(dataID); }
@Override public void bindView(View view, Context context, final Cursor cursor) { boolean inConflict = WebData.Object.inConflict(cursor); if (inConflict) { view.setBackgroundResource(R.color.conflicted); } else { view.setBackgroundResource(android.R.color.black); } super.bindView(view, context, cursor); }
@Override public void onLoaderReset(Loader<Cursor> loader) { listAdapter.swapCursor(null); }