Q:

Adding new contact

I want to add new contact, when i debug i didnt find any error but still i am not able to add new contact. please make a review of my code and guide me.
my Code:
public final class contactadder extends Activity 
{
private EditText ETCname;
private EditText ETCPhNo;
private EditText ETCEmailId;
private Button btnSave;
String ss;
public static final String TAG = "ContactsAdder";

@Override 
public void onCreate(Bundle savedInstanceState) 
{
    super.onCreate(savedInstanceState);    
    setContentView(R.layout.contact_adder);
    ETCname=(EditText)findViewById(R.id.contactNameEditText);
    ETCPhNo=(EditText)findViewById(R.id.contactPhoneEditText);
    ETCEmailId=(EditText)findViewById(R.id.contactEmailEditText);
    btnSave=(Button)findViewById(R.id.contactSaveButton);
    btnSave.setOnClickListener(new View.OnClickListener()
{
   public void onClick(View v)
  {
          String name=ETCname.getText().toString();
      String phone=ETCPhNo.getText().toString();
      String email=ETCEmailId.getText().toString();
     ArrayList<ContentProviderOperation> op=new ArrayList<ContentProviderOperation>();
                    /*  ops.add(ContentProviderOperation.newInsert(ContactsContract.RawContacts.CONTENT_URI)
                    .withValue(ContactsContract.RawContacts.ACCOUNT_TYPE, mSelectedAccount.getType()) 
                    .withValue(ContactsContract.RawContacts.ACCOUNT_NAME, mSelectedAccount.getName()) 
            .build()); */
     op.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)
             .withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, 0)
             .withValue(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE)
             .withValue(ContactsContract.CommonDataKinds.StructuredName.DISPLAY_NAME, name)
             .build());
     op.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)
             .withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, 0)
             .withValue(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE)
             .withValue(ContactsContract.CommonDataKinds.Phone.NUMBER,phone).build());
      Log.i(TAG,"Creating contact: " + name);        
        try
        {
            getContentResolver().applyBatch(ContactsContract.AUTHORITY, op);
            launchContactManager();
        }catch (Exception e) 
        {
            Context ctx = getApplicationContext();  
            CharSequence txt = "Contact creation failed, check logs.";      
            int duration = Toast.LENGTH_SHORT;  
            Toast toast = Toast.makeText(ctx, txt, duration); 
            toast.show();  
            //log exception
            Log.e(TAG, "Exceptoin encoutered while inserting contact: " + e);        
        }
                  }
 }

A:

A cursory glance at your code shows an error on the 5th line of the onClick function:
ArrayList<ContentProviderOperation> op=new ArrayList<ContentProviderOperation>();
ops.add(ContentProviderOperation.newInsert(ContactsContract.RawContacts.CONTENT_URI)

You declare ArrayList "op" and then your next line references "ops"
After fixing that, does logcat list any errors?  Just noticed your comment said no errors.
Is your manifest.xml properly declaring the permissions?  You need to declare <uses-permission android:name="android.permission.WRITE_CONTACTS" />.

