Guest User

Untitled

a guest
Jan 17th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. cursor = db.query(DbHelper.TABLE, null, null, null, null, null, DbHelper.C_TIMESTAMP + " DESC", null);
  2. startManagingCursor(cursor);
  3.  
  4. adapter = new SimpleCursorAdapter(this, R.layout.stream, cursor, FROM, TO);
  5.  
  6. adapter.setViewBinder(VIEW_BINDER);
  7.  
  8. listStream.setAdapter(adapter);
  9. ...
  10.  
  11. static final ViewBinder VIEW_BINDER = new ViewBinder() {
  12.  
  13. public boolean setViewValue(View view, Cursor cursor, int columnIndex) {
  14.  
  15. if (view.getId() == R.id.textTimestamp) {
  16.  
  17.  
  18. String postDate = cursor.getString(columnIndex);
  19.  
  20. ((TextView) view).setText(tHandler.getRelativeLocalTime(view.getContext(),postDate));
  21.  
  22. return true;
  23. ...
  24.  
  25. <ListView
  26. android:layout_height="fill_parent"
  27. android:layout_width="fill_parent"
  28. android:id="@+id/listStream"
  29. android:background="@color/lightGreen"
  30. android:layout_below="@+id/streamHeader">
  31. </ListView>
Add Comment
Please, Sign In to add comment