code: public void setRingtone(Context context, int resId) {
          if (resId > 0) {
              this.ringtoneUri = Uri.parse("android.resource://" +
                  context.getPackageName() + "/" + resId);
          }
      }
docs: Set ringtone resource.
  
  @param context
  @param resId