title: Ringtone and contact tone not set Programatically
body: <p>i m making an app in which i m download ringtones from server and save in sdcard/download and set as alarm,Notification,ringtone and contact tone but when i set it  does not set as contact and ringtone but notification,alarm tone set where is mistake in my code secondly through /sdcard/download/ tones is not save in ome mobile  while through /Download/ </p>
  
  <pre><code>    ringtone.setOnClickListener(new View.OnClickListener() {
                      @Override
                      public void onClick(View v) {
                          String path = Environment.getExternalStorageDirectory().getPath() + "/Download/" + title;
                          setRingtone(path);
                          Toast.makeText(con, "set successfully as ringtone"+title, Toast.LENGTH_LONG).show();
                          dialog.dismiss();
  
                      }
                  });
  
                  alaram.setOnClickListener(new View.OnClickListener() {
                      @Override
                      public void onClick(View v) {
                          String path = Environment.getExternalStorageDirectory().getPath() + "/Download/" + title;
                          setalaram(path);
                          Toast.makeText(con, "set successfully as alaram", Toast.LENGTH_LONG).show();
                          dialog.dismiss();
  
                      }
                  });
  
                  notification.setOnClickListener(new View.OnClickListener() {
                      @Override
                      public void onClick(View v) {
                          String path = Environment.getExternalStorageDirectory().getPath() + "/Download/" + title;
                          setnotication(path);
                          Toast.makeText(con, "set successfully as notification", Toast.LENGTH_LONG).show();
                          dialog.dismiss();
  
                      }
                  });
                 /* contact.setOnClickListener(new View.OnClickListener() {
                      @Override
                      public void onClick(View v) {
                      String path = Environment.getExternalStorageDirectory().getPath() + "/Download/" + title;
                          Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
                          startActivityForResult(intent, PICK_CONTACT);
                          dialog.dismiss();
                      }
                  });*/
  
              }
          });
      @Override
      protected void onActivityResult(int requestCode, int resultCode, Intent data) {
          switch (requestCode)
          {
              case 1:
                  if (resultCode == Activity.RESULT_OK)
                      urlRingTone = String.valueOf(data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI));
                      break;
                  case 2:
                          Uri contactData = data.getData();
                          Cursor c = managedQuery(contactData, null, null, null, null);
                          if (c.moveToFirst()) {
                              String name = c.getString(c.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
                              String path = Environment.getExternalStorageDirectory().getPath() + "/Download/" + title;
                              //setContact(path);
                          }
  
              }
  
          }
  public void setalaram(String path) {
  
  
          File k = new File(path); // path is a file to /sdcard/media/ringtone
  
          ContentValues values = new ContentValues();
          values.put(MediaStore.MediaColumns.DATA, k.getAbsolutePath());
          values.put(MediaStore.MediaColumns.TITLE, title);
          values.put(MediaStore.MediaColumns.MIME_TYPE, "audio/mp3");
          values.put(MediaStore.MediaColumns.SIZE, k.length());
          values.put(MediaStore.Audio.Media.IS_ALARM, true);
  
          Uri uri = MediaStore.Audio.Media.getContentUriForPath(k.getAbsolutePath());
          getContentResolver().delete(uri, MediaStore.MediaColumns.DATA + "=\"" + k.getAbsolutePath() + "\"", null);
          Uri newUri = getContentResolver().insert(uri, values);
  
          RingtoneManager.setActualDefaultRingtoneUri(Play.this,
                  RingtoneManager.TYPE_ALARM, newUri);
      }
  
      public void setnotication(String path) {
  
  
          File k = new File(path); // path is a file to /sdcard/media/ringtone
  
          ContentValues values = new ContentValues();
          values.put(MediaStore.MediaColumns.DATA, k.getAbsolutePath());
          values.put(MediaStore.MediaColumns.TITLE, title);
          values.put(MediaStore.MediaColumns.MIME_TYPE, "audio/mp3");
          values.put(MediaStore.MediaColumns.SIZE, k.length());
          values.put(MediaStore.Audio.Media.IS_NOTIFICATION, true);
  
          Uri uri = MediaStore.Audio.Media.getContentUriForPath(k.getAbsolutePath());
          getContentResolver().delete(uri, MediaStore.MediaColumns.DATA + "=\"" + k.getAbsolutePath() + "\"", null);
          Uri newUri = getContentResolver().insert(uri, values);
  
          RingtoneManager.setActualDefaultRingtoneUri(Play.this,
                  RingtoneManager.TYPE_NOTIFICATION, newUri);
      }
  </code></pre>