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 回答