I am trying to create a  SlidingDrawer that holds a menu with imagebuttons
and each
imagebutton leads to a different content within the drawer (basically it
should look similar
to the image I attached)...would that work with ViewGroup.addView and
LayoutInflater?

On Mon, Aug 2, 2010 at 1:53 AM, Romain Guy <romain...@android.com> wrote:

> A ViewStub is not designed to be recreated and put back in the view
> hierarchy. What are you trying to achieve? If you are trying to add a
> new view to the window every time the user presses a button, just use
> ViewGroup.addView() and LayoutInflater.
>
> On Sun, Aug 1, 2010 at 5:50 PM, kivy <victoriasarabu...@gmail.com> wrote:
> > Hi there,
> >
> > I am trying to recreate and reinflate a ViewStub each time an
> > ImageButton is pressed because at the moment my app crashes as soon as
> > I press the button a second time (due to a NullPointerException caused
> > by the ViewStub that doesn't exist anymore) but I am a little stuck as
> > I don't know how to recreate and reinvoke the ViewStub...
> >
> > If someone could give me a hand here, that would be great.
> > Thanks in  advance.
> >
> > This is what I have done so far:
> >
> >  btnExposure = (ImageButton) findViewById(R.id.button_exposure);
> >
> >      btnExposure.setOnClickListener(new OnClickListener()
> >        {
> >
> >                @Override
> >                public void onClick(View v) {
> >                     if (findViewById(R.id.stub_exposure) != null){
> >                         ViewStub stub1 = (ViewStub)
> > findViewById(R.id.stub_exposure);
> >                         importStub = stub1.inflate();
> >                         toggle(importStub2);
> >                         }
> >                     else {
> >                         //DON'T KNOW WHAT I SHOULD DO HERE
> >                     }
> >                }
> >
> >
> >           }
> >        );
> >
> > --
> > 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<android-developers%2bunsubscr...@googlegroups.com>
> > For more options, visit this group at
> > http://groups.google.com/group/android-developers?hl=en
> >
>
>
>
> --
> Romain Guy
> Android framework engineer
> romain...@android.com
>
> Note: please don't send private questions to me, as I don't have time
> to provide private support.  All such questions should be posted on
> public forums, where I and others can see and answer them
>
> --
> 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<android-developers%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

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

<<attachment: SlidingDrawerExample.png>>

Reply via email to