KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Hi am implementing a SMS App, now am able to retrieve all messages with their respective contact info like display name, photo uri.. and am displaying them in a custom list where on item click takes you to respective discussion. Here my issues is the time taking to sync all these messages, I need to optimize this time. Each time i send a new message in the discussion view and go back to recent chats i need to only update the particular item, not the whole list. Here's my code: ReadSMS.java: public class ReadSMS { ArrayList<HashMap<Contact, ArrayList<OneComment>>> recentChats; Application _context; public ReadSMS(Application context) { this._context = context; this.recentChats = ((ChatApplication) _context).getChats(); } public ArrayList<HashMap<Contact, ArrayList<OneComment>>> getSMS() { // Init ArrayList<SmsMsg> smsMsgs = new ArrayList<SmsMsg>(); TreeSet<Integer> threadIds = new TreeSet<Integer>(); Uri mSmsinboxQueryUri = Uri.parse("content://sms"); Cursor cursor = _context.getContentResolver().query( mSmsinboxQueryUri, new String[] { "_id", "thread_id", "address", "date", "body", "type" }, null, null, null); String[] columns = new String[] { "address", "thread_id", "date", "body", "type" }; if (cursor.getCount() > 0) { while (cursor.moveToNext()) { SmsMsg smsMsg = new SmsMsg(); String address = null, displayName = null, date = null, msg = null, type = null, threadId = null; Uri photoUri = null; threadId = cursor.getString(cursor.getColumnIndex(columns[1])); type = cursor.getString(cursor.getColumnIndex(columns[4])); if (Integer.parseInt(type) == 1 || Intege
Tags (comma-separated)
Save Edits
Cancel