[/code]"> [/code]"> [/code]">
I wordering how to use ContactsContract.Contacts.CONTACT_LAST_UPDATED_TIMESTAMP in android ?

Below is my code which shows IllegalStateException.
[code] Cursor allContacts = this.getContentResolver().query( ContactsContract.RawContacts.CONTENT_URI, null, null, null, null); StringBuilder sbCurrentVersion = new StringBuilder(); allContacts.moveToFirst(); for (int i = 0; i < allContacts.getCount(); i++) { String id = allContacts.getString(allContacts.getColumnIndex(ContactsContract.Contacts._ID)); String name = allContacts.getString(allContacts.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME)); String col = allContacts.getString(allContacts.getColumnIndex(ContactsContract.Contacts.CONTACT_LAST_UPDATED_TIMESTAMP)); sbCurrentVersion.append(" "+id+":"+name+" : "+col); allContacts.moveToNext(); } It shows following IllegalStateException java.lang.IllegalStateException: Couldn't read row 0, col -1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it. at android.database.CursorWindow.nativeGetString(Native Method) at android.database.CursorWindow.getString(CursorWindow.java:438) at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:51) at android.database.CursorWrapper.getString(CursorWrapper.java:137) at com.example.dj.contentobserverdemo.ContentObserverService.sGetCurrentContatcsVersions(ContentObserverService.java:111) at com.example.dj.contentobserverdemo.ContentObserverService.access$000(ContentObserverService.java:23) at com.example.dj.contentobserverdemo.ContentObserverService$MyContentObserver.onChange(ContentObserverService.java:83) at android.database.ContentObserver.onChange(ContentObserver.java:130) at android.database.ContentObserver.onChange(ContentObserver.java:145) at android.database.ContentObserver$NotificationRunnable.run(ContentObserver.java:216) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:148) at android.os.HandlerThread.run(HandlerThread.java:61)[/code]


JLCPCB – Prototype 10 PCBs for $2 (For Any Color)

China’s Largest PCB Prototype Enterprise, 600,000+ Customers & 10,000+ Online Orders Daily
How to Get PCB Cash Coupon from JLCPCB: https://bit.ly/2GMCH9w

Syed Zain Nasir

I am Syed Zain Nasir, the founder of <a href=https://www.TheEngineeringProjects.com/>The Engineering Projects</a> (TEP). I am a programmer since 2009 before that I just search things, make small projects and now I am sharing my knowledge through this platform.I also work as a freelancer and did many projects related to programming and electrical circuitry. <a href=https://plus.google.com/+SyedZainNasir/>My Google Profile+</a>

Share
Published by
Syed Zain Nasir