Try to create multiple contacts programmatically with same firstname
<p>I use following code for creating new contact programmatically.
This code create a new contact in contact list with given details, but if firstname of contact same and run this code from loop for creating multiple contacts having same firstname fields e.g. "Crashre1234" then it add all fields in the single contact multiple time(according to loop). I use the current system time with fields to create difference.
But no luck.
I don't understand what I miss. </p>

<pre><code>                ArrayList&lt;ContentProviderOperation&gt; op_list = new ArrayList&lt;ContentProviderOperation&gt;();
                op_list.clear();
                long tti = System.currentTimeMillis();
                ///for(int i=0;i&lt;2;i++)
                {
                    try{

                        int backRefIndex = 0;
                        System.out.println("Array List: "+backRefIndex);
                        op_list.add(ContentProviderOperation.newInsert(RawContacts.CONTENT_URI)
                        .withValue(RawContacts.ACCOUNT_TYPE, null)
                        .withValue(RawContacts.ACCOUNT_NAME, null)
                        .build());
                        //backRefIndex = backRefIndex+1;

                        op_list.add(ContentProviderOperation.newInsert(Data.CONTENT_URI)
                        .withValueBackReference(Data.RAW_CONTACT_ID, backRefIndex)
                        .withValue(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE)
                        .withValue(StructuredName.GIVEN_NAME, "Crashre1234"+"\r")
                        .build());
                        //backRefIndex = backRefIndex+1;

                        /*op_list.add(ContentProviderOperation.newInsert(Data.CONTENT_URI)
                        .withValueBackReference(Data.RAW_CONTACT_ID, backRefIndex)
                        .withValue(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE)
                        .withValue(StructuredName.FAMILY_NAME, "ABCre12")
                        .build());*/
                        //backRefIndex = backRefIndex+1;

                         op_list.add(ContentProviderOperation.newInsert(Data.CONTENT_URI)
                        .withValueBackReference(Data.RAW_CONTACT_ID, backRefIndex)
                        .withValue(Data.MIMETYPE, StructuredPostal.CONTENT_ITEM_TYPE)
                        .withValue(StructuredPostal.FORMATTED_ADDRESS, "Secret password"+tti)
                        .build());
                        // backRefIndex = backRefIndex+1;

                         op_list.add(ContentProviderOperation.newInsert(Data.CONTENT_URI)
                         .withValueBackReference(Data.RAW_CONTACT_ID, backRefIndex)
                        .withValue(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE)
                        .withValue(Phone.NUMBER, 11+tti)
                        .withValue(Phone.TYPE, Phone.TYPE_HOME)
                        .withValue(Phone.LABEL, "")
                        .build());
                        // backRefIndex = backRefIndex+1;

                         op_list.add(ContentProviderOperation.newInsert(Data.CONTENT_URI)
                         .withValueBackReference(Data.RAW_CONTACT_ID, backRefIndex)
                         .withValue(Data.MIMETYPE, Email.CONTENT_ITEM_TYPE)
                         .withValue(Email.DATA, "Test@11test.com12"+tti)
                         .withValue(Email.TYPE, Email.TYPE_HOME)
                         .build());
                        // backRefIndex = backRefIndex+1;
                         op_list.add(ContentProviderOperation.newInsert(Data.CONTENT_URI)
                         .withValueBackReference(Data.RAW_CONTACT_ID, backRefIndex)
                         .withValue(Data.MIMETYPE, Email.CONTENT_ITEM_TYPE)
                         .withValue(Email.DATA, "mobile@test12.com12"+tti)
                         .withValue(Email.TYPE, Email.TYPE_HOME)
                         .build());
                        // backRefIndex = backRefIndex+1;

                         ContentProviderResult[] result = activity.getContentResolver().applyBatch(ContactsContract.AUTHORITY, op_list);
                         Uri uri = result[0].uri;
                         System.out.println("URI: "+uri);
                         System.out.println("Thread finish");
                          }catch(OperationApplicationException exp){
                           exp.printStackTrace();
                          }catch(RemoteException exp){
                           exp.printStackTrace();
                        }
                    }   
</code></pre>
