-1

您好我正在开发一个 android SMS 应用程序,其中我试图包含 settings.xml 与包含两个 CheckBoxPreference 和一个 ListPreference 类似于链接的首选项

https://androidresearch.wordpress.com/2012/03/09/creating-a-preference-activity-in-android/

我希望 ListPreference 显示来自电话的默认铃声。如何从 listprefernce 调用活动

public class Preference extends PreferenceActivity implements OnPreferenceClickListener 
{
   private ListPreference mListPreference;
   protected void onCreate(Bundle savedInstanceState) 
   {
     super.onCreate(savedInstanceState);
     addPreferencesFromResource(R.xml.preference);

       mListPreference.setOnPreferenceChangeListener(new  OnPreferenceChangeListener() 
       {
          public boolean onPreferenceChange(android.preference.Preference preference, Object newValue)
        {
          //how to call an activity in this place
          return true;
         }
      });
   }
}
4

1 回答 1

0

I think, what you really want to have is a RingtonePreference:

<RingtonePreference android:key="ringtone" android:ringtoneType="notification"/>

https://developer.android.com/reference/android/preference/RingtonePreference.html

于 2013-09-06T04:46:53.923 回答