Android get a cursor only with contacts that have an email listed >android 2.0

@CapDroid Fixed working code from DArkO’s post: ContentResolver cr = context.getContentResolver(); String[] PROJECTION = new String[] { ContactsContract.RawContacts._ID, ContactsContract.Contacts.DISPLAY_NAME, ContactsContract.Contacts.PHOTO_ID, ContactsContract.CommonDataKinds.Email.DATA, ContactsContract.CommonDataKinds.Photo.CONTACT_ID }; String order = “CASE WHEN ” + ContactsContract.Contacts.DISPLAY_NAME + ” NOT LIKE ‘%@%’ THEN 1 ELSE 2 END, ” + ContactsContract.Contacts.DISPLAY_NAME + “, ” + ContactsContract.CommonDataKinds.Email.DATA + ” COLLATE NOCASE”; String filter … Read more

Android Cursor with ORMLite to use in CursorAdapter

ORMLite now supports next(), previous(), moveRelative(offset), … methods on the CloseableIterator class. This should allow you to move the underlying Cursor object around at will. It also supports the following DAO Cursor methods: dao.mapSelectStarRow(databaseResults) Return the latest row from the database results from a query to select *. With this you can change the cursor … Read more

how to display images saved in sdcard folder in android [closed]

You can get the path of files from a particualr folder as below Once you get the path of files you ca display the images in gridview ArrayList<String> f = new ArrayList<String>();// list of file paths File[] listFile; public void getFromSdcard() { File file= new File(android.os.Environment.getExternalStorageDirectory(),”TMyFolder”); if (file.isDirectory()) { listFile = file.listFiles(); for (int i … Read more

android java.lang.IllegalStateException: Couldn’t read row 0, col 0 from CursorWindow

01-29 13:41:56.520: W/CursorWindow(4121): Window is full: requested allocation 5140987 bytes, free space 2096617 bytes, window size 2097152 bytes Android SQLite returns rows in cursor windows that have the maximum size of 2MB as specified by config_cursorWindowSize. If your row exceeds this limit, you’ll get this error. Storing large data in sqlite database is not a … Read more

How to get contacts’ phone number in Android

Android Contact API For 2.0 // // Find contact based on name. // ContentResolver cr = getContentResolver(); Cursor cursor = cr.query(ContactsContract.Contacts.CONTENT_URI, null, “DISPLAY_NAME = ‘” + NAME + “‘”, null, null); if (cursor.moveToFirst()) { String contactId = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts._ID)); // // Get all phone numbers. // Cursor phones = cr.query(Phone.CONTENT_URI, null, Phone.CONTACT_ID + ” = ” … Read more

CursorOutofBoundsException Index -1 requested with size of 0

change your insertion code to this: SQLiteDatabase db7 = db.getWritableDatabase(); ContentValues values5= new ContentValues(); for (int i = 0; i < poslist.size(); i++) { values5.put(DBManager.TableInfo.KEYID, ID1); values5.put(DBManager.TableInfo.DOCU, document); values5.put(DBManager.TableInfo.ATTEND,attendancelist.get(i)); values5.put(DBManager.TableInfo.EMAIL, emaillist.get(i)); values5.put(DBManager.TableInfo.PARTY,partytypelist.get(i) ); values5.put(DBManager.TableInfo.BIO,biometriclist.get(i)); values5.put(DBManager.TableInfo.KEY_LOGIN_USER,username2); String condition5 = DBManager.TableInfo.DOCU + ” =?”; Cursor cursor5 = db7.query(DBManager.TableInfo.UPDATEPARTY, null, condition5, new String[]{DBManager.TableInfo.ATTEND}, null, null, null); long status5 … Read more