Bluetoothsetting. Java interface entry method:
Void addpreferencesforactivity (){
Addpreferencesfromresource (R. xml. descrith_settings );
......
}
Bluetooth_settings.xml is just a preferencescreen
The Bluetooth setting interface is somewhat complicated at first, but it will be much easier if you are familiar with the new interface property fragment of android4.0. Let's first look at javasthsettings. Java
Class incluthsettings extends devicelistpreferencefragment
The first step is to inherit devicelistpreferencefragment. From the perspective of its name, we can see that it is a list,
Devicelistpreferencefragment extends settingspreferencefragment
Settingspreferencefragment extends preferencefragment
Preferencefragment extends Fragment
We can see thsetting. java is a fragment and a fragment with the list type. fragment is a special interface that allows us to add others, as is the case in javasthsetting, add a new preferencegroup to update the Bluetooth setting interface. The method is adddevicecategory (). The main function of this method includes the newly added interface content and the corresponding title, set the data source (through filter) to update the interface from the surface.