I agree that yours seems to work.  I'm trying to figure out the
difference between our code now.  Thanks.

On Apr 21, 6:42 am, Mark Murphy <mmur...@commonsware.com> wrote:
> I cannot reproduce your problem.
>
> For example, try:
>
> http://misc.commonsware.com.s3.amazonaws.com/SpinnerGone.zip
>
> This is the Selection/Spinner example from one of my books, with two changes:
>
> 1. It sets android:visibility="gone" on the Spinner in the layout
>
> 2. It logs the selected item from the Spinner in onDestroy()
>
> It works properly, showing the automatically-selected first word out
> of the ArrayAdapter.
>
>
>
>
>
>
>
>
>
> On Thu, Apr 21, 2011 at 9:21 AM, Keith Wiley <kbwi...@gmail.com> wrote:
> > I have a large layout and I hide whole sections of it at a time by
> > wrapping numerous related UI elements in a sublayout and toggling that
> > sublayout's visibility between "visible" and "gone" via a button
> > (which is obvious not contained within the sublayout itself).  I want
> > to start with all these "section" sublayouts in the "gone" state
> > (either in the xml itself, or by setting those layouts to gone in
> > onCreate(), I've tried it both ways, same erroneous result occurs).
> > That is, I want all sections to be initially minimized and the overall
> > layout as minimal as possible.
>
> > At onCreate() time I initialize all my UI elements.  Later, when the
> > user closes the layout I want to read all the settings of all the
> > elements.  However, those that were "gone" during initialization
> > (which is to say, all of them since I start with everything "gone")
> > were never initialized (for example, a spinner's selected view is null
> > despite having been assign in onCreate()).  I interpret this as
> > indicating that UI elements are not really assigned when you assign
> > them, but rather, during layout time, so if the element is never
> > visible, the command to assign its value (a spinner's selection) never
> > follows through.
>
> > So, it seems like commands to assign UI element values only occur
> > after the elements are laid out, meaning after they become visible.
> > Will commands to initialize an element never take effect if the
> > element is never made visible?  If so, how do I achieve my intended
> > goal of a bunch of hidden settings, some of which may not even be
> > unhidden at all before the user decides to exit the settings?
>
> > --
> > 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
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Android 3.0 Programming Books:http://commonsware.com/books

-- 
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

Reply via email to