>From the code here: http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/java/android/preference/PreferenceScreen.java;h=9929b963755e03609c37822b01fe101f3ce575a2;hb=HEAD it looks like mDialog is only valid when that particular (inner) PreferenceScreen is shown, i.e. when you see the contents of that PreferenceScreen. So it the return value of getDialog() is depending on when exactly you call it.
What is it exactly you want to achieve after accessing the dialog? On Tue, Feb 10, 2009 at 3:11 AM, robert <ma.ning....@gmail.com> wrote: > > Dear Christoph > Thanks for ur reply:) > I've tried as you said and I got the concept of the structure.But > there is still a problem when I use the getDialog() method. > I found that the return of this method is null when using it in my > program but not null when I use ddms to debug and check the mDialog, > and the mDialog is just set null in onDismiss() method, but ddms can't > go into this method at running time, so I'm not sure whether this > mDialog is the reference of the inner PreferenceScreen and can we get > it by getDialog(), this is the annotation of getDialog() : ' Used to > get a handle to the dialog. This is useful for cases where we want to > manipulate the dialog as we would with any other activity or view.' > > On Feb 10, 9:53 am, Christoph Studer <chstu...@gmail.com> wrote: >> When the PreferenceActivity encounters nested PreferenceScreens in the >> hierarchy, it will add the inner PreferenceScreen as a list entry >> (similar appearance as e.g. for a EditTextPreference) to the outer >> PreferenceScreen. When the user clicks on this list entry, the >> contents of the inner PreferenceScreen will be shown. >> >> If this explanation does not make sense to you, just open Settings on >> your phone. You can imagine all the entries shown on that screen >> ("Wireless controls", "Call settings" etc.) being inner >> PreferenceScreens of the main PreferenceScreen. When you click on an >> entry, the contents of that particular inner PreferenceScreen will be >> shown. >> >> I think the "Dialog" refers to the new - automatically generated - >> screen that is shown when you click on the list entry and drill down >> into the inner PreferenceScreen. It doesn't really look like a dialog, >> but that's probably what it is. (As an alternative, the inner >> PreferenceScreen could specify an activity intent that is fired when >> the user clicks on its list entry.) >> >> Christoph >> >> On Tue, Feb 10, 2009 at 2:00 AM, robert <ma.ning....@gmail.com> wrote: >> >> > Hi All: >> > When I see the doc of Preference Screen, there is one paragraph >> > about the sub-preference screen related to dialog, the doc is as >> > follow: >> > ---> When it appears inside another preference hierarchy, it is >> > shown and serves as the gateway to another screen of >> > preferences (either by showing another screen of preferences as a >> > Dialog or via a Context.startActivity(android.content.Intent) from the >> > Preference.getIntent()). The children of this PreferenceScreen are >> > NOT shown in the screen that this PreferenceScreen is shown in. >> > Instead, a separate screen will be shown when this preference is >> > clicked. >> > But in Android Api Demo, the Preference from code, I find nothing >> > related to Dialog when using PreferenceScreen as the base element of >> > preference, and I have no idea about 'showing another screen of >> > preferences as a Dialog', what does it mean? Is there a pop-dialog >> > when we click anywhere in Preference Screen? But the Preference Screen >> > is invisible. So I wanna know if there is any suggestion about my >> > question, and thanks in advance! >> >> > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---