Buggy code:
private LinearLayout websiteLayout ; private LinearLayout faxLayout ; private RelativeLayout mobileLayout ; private RelativeLayout phoneLayout ; private EditText editMobileNumber ; private EditText editPhoneNumber ; private EditText editCity ; private EditText editEmail ; private EditText editState ; private EditText editCountry ; private EditText editPincode ; private EditText editWebsite ; private EditText editFax ; private EditText editStreet ; private EditText editStreet2 ; private String stringName ; private String stringMobileNumber ; private String stringPhoneNumber ; private String stringEmail ; private String stringStreet ; private String stringStreet2 ; private String stringCity ; private String stringPincode ; private String stringStateId ; private String stringStateName ; private String stringCountryId ; private String stringCountryName ; private String stringWebsite ; private String stringFax ; private String stringImage ; private int _id ; private String address ; private CoordinatorLayout coordinatorLayout ; private LinearLayout viewLayout ; private LinearLayout editLayout ; @ Override protected void onCreate ( Bundle savedInstanceState ) { } private void init ( ) { } @ Override public void onClick ( View v ) { } private void updateRecords ( ) { } private void selectImage ( ) { } @ Override protected void onActivityResult ( int requestCode , int resultCode , Intent data ) { } @ Override public boolean onCreateOptionsMenu ( Menu menu ) { } @ Override public boolean onOptionsItemSelected ( MenuItem item ) { } private void addContactToDevice ( String stringName , String stringImage , String stringMobileNumber , String stringPhoneNumber , String stringEmail , String stringStreet , String stringStreet2 , String stringCity , String stringCountryName , String stringFax , String stringWebsite , String stringPincode ) { ArrayList < ContentProviderOperation > ops = new ArrayList < > ( ) ; int rawContactInsertIndex = 0 ; <START_BUG> ops . add ( ContentProviderOperation . newInsert ( CONTENT_URI ) . withValue ( ACCOUNT_TYPE , AUTH_TYPE ) . withValue ( ACCOUNT_NAME , getAccount ( ) ) . build ( ) ) ; <END_BUG> ops . add ( ContentProviderOperation . newInsert ( ContactsContract . Data . CONTENT_URI ) . withValueBackReference ( RAW_CONTACT_ID , rawContactInsertIndex ) . withValue ( MIMETYPE , CONTENT_ITEM_TYPE ) . withValue ( DISPLAY_NAME , stringName ) . build ( ) ) ; if ( ( ! ( stringImage . equals ( "false" ) ) ) && ( ! ( stringImage . isEmpty ( ) ) ) ) { Bitmap bitmap = BitmapUtils . getBitmapImage ( this , stringImage ) ; ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; bitmap . compress ( JPEG , 80 , baos ) ; ops . add ( ContentProviderOperation . newInsert ( ContactsContract . Data . CONTENT_URI ) . withValueBackReference ( RAW_CONTACT_ID , rawContactInsertIndex ) . withValue ( MIMETYPE , ContactsContract . CommonDataKinds . Photo . CONTENT_ITEM_TYPE ) . withValue ( PHOTO , baos . toByteArray ( ) ) . build ( ) ) ; } ops . add ( ContentProviderOperation . newInsert ( ContactsContract . Data . CONTENT_URI ) . withValueBackReference ( ContactsContract . Data . RAW_CONTACT_ID , rawContactInsertIndex ) . withValue ( MIMETYPE , Phone . CONTENT_ITEM_TYPE ) . withValue ( NUMBER , stringMobileNumber ) . withValue ( TYPE , TYPE_MOBILE ) . build ( ) ) ; ops . add ( ContentProviderOperation . newInsert ( ContactsContract . Data . CONTENT_URI ) . withValueBackReference ( ContactsContract . Data . RAW_CONTACT_ID , rawContactInsertIndex ) . withValue ( ContactsContract . Data . MIMETYPE , Phone . CONTENT_ITEM_TYPE ) . withValue ( NUMBER , stringPhoneNumber ) . withValue ( TYPE , TYPE_HOME ) . build ( ) ) ; ops . add ( ContentProviderOperation . newInsert ( ContactsContract . Data . CONTENT_URI ) . withValueBackReference ( ContactsContract . Data . RAW_CONTACT_ID , rawContactInsertIndex ) . withValue ( ContactsContract . Data . MIMETYPE , Phone . CONTENT_ITEM_TYPE ) . withValue ( NUMBER , stringFax ) . withValue ( TYPE , TYPE_OTHER_FAX ) . build ( ) ) ; ops . add ( ContentProviderOperation . newInsert ( ContactsContract . Data . CONTENT_URI ) . withValueBackReference ( ContactsContract . Data . RAW_CONTACT_ID , rawContactInsertIndex ) . withValue ( MIMETYPE , ContactsContract . CommonDataKinds . Email . CONTENT_ITEM_TYPE ) . withValue ( DATA , stringEmail ) . withValue ( ContactsContract . CommonDataKinds . Email . TYPE , TYPE_WORK ) . build ( ) ) ; ops . add ( ContentProviderOperation . newInsert ( ContactsContract . Data . CONTENT_URI ) . withValueBackReference ( ContactsContract . Data . RAW_CONTACT_ID , rawContactInsertIndex ) . withValue ( MIMETYPE , ContactsContract . CommonDataKinds . Website . CONTENT_ITEM_TYPE ) . withValue ( URL , stringWebsite ) . withValue ( ContactsContract . CommonDataKinds . Website . TYPE , ContactsContract . CommonDataKinds . Website . TYPE_HOME ) . build ( ) ) ; address = String . valueOf ( new StringBuilder ( stringStreet ) . append ( ",<seq2seq4repair_space>" ) . append ( stringStreet2 ) ) ; if ( stringStreet . equals ( "" ) ) { if ( stringStreet2 . equals ( "" ) ) { address = "" ; } else { address = stringStreet2 ; } } else { address = stringStreet ; } ops . add ( ContentProviderOperation . newInsert ( ContactsContract . Data . CONTENT_URI ) . withValueBackReference ( ContactsContract . Data . RAW_CONTACT_ID , rawContactInsertIndex ) . withValue ( MIMETYPE , ContactsContract . CommonDataKinds . StructuredPostal . CONTENT_ITEM_TYPE ) . withValue ( STREET , address ) . withValue ( MIMETYPE , ContactsContract . CommonDataKinds . StructuredPostal . CONTENT_ITEM_TYPE ) . withValue ( CITY , stringCity ) . withValue ( MIMETYPE , ContactsContract . CommonDataKinds . StructuredPostal . CONTENT_ITEM_TYPE ) . withValue ( POSTCODE , stringPincode ) . build ( ) ) ; try { ContentProviderResult [ ] res = this . getContentResolver ( ) . applyBatch ( AUTHORITY , ops ) ; if ( ( res . length ) > 0 ) { final ContentProviderResult result = res [ 0 ] ;

Fix:
ops . add ( ContentProviderOperation . newInsert ( CONTENT_URI ) . withValue ( ACCOUNT_TYPE , AUTH_TYPE ) . withValue ( ACCOUNT_NAME , getAccount ( ) . name ) . build ( ) ) ;