Hrm, I'm really tired right now so might be missing something stupid,
but right now the code i have is:


                final ViewFlipper flipper = null;

                final Button Button04 = (Button) findViewById(R.id.Button04);

                final LinearLayout llayout = new 
LinearLayout(R.layout.business);

                Button04.setOnClickListener(new View.OnClickListener(){
                        public void onClick(View v) {
                                flipper.showContextMenuForChild(llayout);

                        }
                });

which... well, doesn't work - it doesn't like the "new
LinearLayout(R.layout.business);" part, saying "business" has to be an
int.  business refers to business.xml.  I'm not sure how to do this
and have tried to find examples for showContextMenuForChild, but can't
find any applicable to my use.

Basically, eventually in my button onclicklistener I want to test the
spinner to see what its value is, then show the right layout.

On Apr 24, 5:41 pm, Mark Murphy <mmur...@commonsware.com> wrote:
> moiraine wrote:
> > Some background:  I have a Spinner, with options "address" and
> > "business", and I've done some research and I think it's hard to do
> > stuff on select?
>
> Not really. Here is a sample project that shows getting control when the
> user makes a selection:
>
> http://github.com/commonsguy/cw-android/tree/master/Selection/Spinner/
>
> > I'd like to be able to load up a layout on the same intent dependent
> > on what the spinner's current value is, so if it's "address", add
> > address.xml's contents onto the current layout, otherwise if it's
> > "business", use business (they have different information to input is
> > why they're different).  I was hoping to not have to create another
> > activity/intent.
>
> Why not?
>
> > Is there a way to do this?
>
> If you want to keep your Spinner, the simplest approach may be to use a
> ViewFlipper for the stuff that varies based upon Spinner selection.
>
> This is the sort of thing one usually uses tabs for (see TabHost and
> TabWidget), though perhaps there are too many items in your Spinner for
> that.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> _Android Programming Tutorials_ Version 2.0 Available!
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Beginners" group.
>
> NEW! Try asking and tagging your question on Stack Overflow 
> athttp://stackoverflow.com/questions/tagged/android
>
> To unsubscribe from this group, send email to
> android-beginners+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/android-beginners?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to