2012-10-16 7 views
1

를 선택해야하나요? 잘 작동하지만 전화 벨소리에서 알림 sount를 설정할 수 있습니다.내가이</p> <pre><code>Ringtone tone = RingtoneManager.getRingtone(this, Uri.parse(uri)); </code></pre> <p>알림 음 선택하는 데 사용할 수있는 방법 NotificationTone

업데이트 : RingtoneManager에서 제공

private void update_notifytone (String uri, boolean save) { 
     mNotifyTone = uri; 
     if (uri == null) return; 

     Ringtone tone = RingtoneManager.getRingtone(this, Uri.parse(uri)); 


     if (tone != null) 
      mPrefNotifyTone.setSummary(tone.getTitle(this)); 
     if (save) 
      update_column(ProfileModel.ProfileColumns.NOTIFYTONE, mNotifyTone); 
    } 

감사

답변

1

사용

RingtoneManager mRing= new RingtoneManager(RingtoneActivity.this); 
int mNumberOfRingtones = mRing.getCursor().getCount(); 

Uri mRingToneUri = mRing.getRingtoneUri((int) (Math.random() * mNumberOfRingtones)); 

커서가 임의의 하나를 사용하여 예에서, 장치의 사용 가능한 벨소리에 액세스 할 수 있습니다.

+0

응답 해 주셔서 감사합니다. 그러나 여전히 알림 소리에 액세스 할 수 없습니다. –

+0

welcome - mRing.getCursor()를 사용하면 소리에 액세스하는 데 사용할 수있는 커서가 있어야합니다 - 어디서 잘못 되었습니까? – dorjeduck

+0

코드가있는 업데이트 된 질문을 참조하십시오. 내 방법으로 당신의 대답을하고 싶습니다 –