3

着信音の好みがあります。どうすればセレクションを入手できますか?私は次の種類のコードを持っています:

if(preferences.getString("ringtonePref", "n/a") != ??)
            {
                Toast.makeText(TutorialPref.this,   "Chosen ringtone: silent", Toast.LENGTH_LONG).show();
            }
            else if(preferences.getString("ringtonePref", "n/a") != "DEFAULT_RINGTONE_URI" )
            {
                Toast.makeText(TutorialPref.this,   "Chosen ringtone: + default", Toast.LENGTH_LONG).show();
            }
4

1 に答える 1

4

これは、選択を通知インスタンスに割り当てる方法です。

String strRingtonePreference = preferences.getString("ringtonePref", "DEFAULT_RINGTONE_URI");
notification.sound = Uri.parse(strRingtonePreference);

通知の場所:

Notification notification = new Notification(icon, tickerText, time);

ここで詳細を確認できます: http://developer.android.com/reference/android/app/Notification.html

于 2011-02-05T00:23:03.377 に答える