Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private List<FbConversation> getFbConversations(String id_field, GenericSqliteHelper helper, final String account) {
- if (helper == null) {
- if (Cfg.DEBUG) {
- Check.log(TAG + " (getFbConversations) Error: null helper");
- }
- return null;
- }
- final List<FbConversation> conversations = new ArrayList<FbConversation>();
- // "thread_id"
- String[] projection = new String[] { id_field, M.e("participants"), M.e("timestamp_ms") };
- String selection = M.e("timestamp_ms > 0 ");
- RecordVisitor visitor = new RecordVisitor(projection, selection) {
- @Override
- public long cursor(Cursor cursor) {
- FbConversation c = new FbConversation();
- c.account = account;
- c.id = cursor.getString(0);
- String value = cursor.getString(1);
- c.timestamp = cursor.getLong(2);
- Contact[] contacts;
- try {
- contacts = json2Contacts(value);
- c.contacts = contacts;
- if (Cfg.DEBUG) {
- // Check.log(TAG + " (cursor) contacts: " +
- // contacts[0].name + " -> " + contacts[1].name);
- }
- } catch (JSONException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- conversations.add(c);
- return 0;
- }
- };
- helper.traverseRecords(M.e("threads"), visitor);
- return conversations;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement