Understanding Ringtone Preference

RingtonePreference deals specifically with ringtones. You'd use it in an application that gives the user an option to select a ringtone as a preference. Figure 11-5 shows the UI of the RingtonePreference example and Listing 11-6 shows the XML. Figure 11-5. The RingtonePreference example UI Figure 11-5. The RingtonePreference example UI Listing 11-6. Defining a RingtonePreference Preference ringtone.xml (store at res xml ringtone.xml) < xml version 1.0 encoding utf-8 > < PreferenceScreen...

Understanding and Using Custom Permissions

Android allows you to define custom permissions with your application. For example, if you wanted to prevent certain users from starting one of the activities in your application, you could do that by defining a custom permission. To use custom permissions, you first declare them in your AndroidManifest.xml file. Once you've defined a permission, you can then refer to it as part of your component definition. We'll show you how this works. Let's create an application containing an activity that...