Recently, we are studying settings of Android 4.04.
From public class settings extends preferenceactivity implements buttonbarhandler, you can know the basic relationship of settings: settings is preferenceactivity.
So how do I add each item of preferenceactivity ?? The following figure shows the signal process through log printing:
Preferenceactivity ---- setlistadapter -----> headeradapter (mheaders) ----> headerviewholder (imageview icon; textview title; textview summary ;).
The basic implementation is to use the headeradapter to adapt the mheaders to the listview. When adapting to each header, the icon, title, and summary of the header will be taken out and put into headerviewholder. settag (holder); Set holer to view, and return each view as an item.
The next step is to listen to each item: onlistitemclick ----> onheaderclick. In onheaderclick, there are three functions, including startwithfragment, switchtoheader, and startactivity, to redirect the interface as needed.