Solved my problem.
I must have the starred in the first operation.
Like this:
operations.add(ContentProviderOperation.newInsert(
ContactsContract.RawContacts.CONTENT_URI)
.withValue(ContactsContract.RawContacts.ACCOUNT_TYPE, null)
.withValue(ContactsContract.RawContacts.ACCOUNT_NAME, null)
.withValue(RawContacts.STARRED, strStarred)
.build());
And remove this:
if(starred == true) {
operations.add(ContentProviderOperation.newInsert(ContactsContract.RawContacts.CONTENT_URI)
.withValueBackReference(RawContacts._ID, 0)
.withValue(RawContacts.STARRED, "1")
.build());
}