Filed bug for this after creating test project that repo'd error:

http://code.google.com/p/android/issues/detail?id=4936

On Nov 19, 2:12 pm, Stephen Abrams <[email protected]> wrote:
> Some updates here,
>
> I played with the Hello, Spinner demo and couldn't repo the problem.
> It exists only when the Spinner is called from a Dialog.  I've seen it
> happen in 1.6, but not 1.5.
>
> Additionally, it has been described on this list before, but without
> resolution:
>
> http://osdir.com/ml/Android-Developers/2009-08/msg00969.html
>
> On Nov 18, 3:18 pm, Stephen Abrams <[email protected]> wrote:
>
> > This may be a bug, but not if there is a way to attach the view to the
> > window manager.
>
> > I have a class extending AlertDialog. The dialog has a drop down menu
> > that allows user to choose item.  When the orientation is changed with
> > the drop down menu displayed, I get the exception listed below.  I set
> > up the drop down view/resources in onStart() of the Dialog, as shown:
>
> >     protected void onStart() {
> >         super.onStart();
>
> >         mySpinner = (Spinner) findViewById(R.id.spinner);
> >         mySpinnerAdapter = new ArrayAdapter<Tee>(context,
> > android.R.layout.simple_spinner_item, myList);
>
> >         
> > mySpinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
> >         mySpinner.setAdapter(mySpinnerAdapter);
>
> >     }
>
> > This error is occuring because, though this Dialog is managed by the
> > Activity (using onCreateDialog, onPrepareDialog, etc.), the View
> > generated by the SpinnerAdapter is not.  I see there is a way to grab
> > individual items from the drop down view, but not get the view itself
> > (to attach it).
>
> > How can the SpinnerAdapter not cause problems on any orientation change?
>
> > E/AndroidRuntime( 5329): java.lang.IllegalArgumentException: View not
> > attached to window m
> > anager
> > E/AndroidRuntime( 5329):        at
> > android.view.WindowManagerImpl.findViewLocked(WindowMan
> > agerImpl.java:355)
> > E/AndroidRuntime( 5329):        at
> > android.view.WindowManagerImpl.removeView(WindowManager
> > Impl.java:200)
> > E/AndroidRuntime( 5329):        at
> > android.view.Window$LocalWindowManager.removeView(Windo
> > w.java:417)
> > E/AndroidRuntime( 5329):        at
> > android.app.Dialog.dismissDialog(Dialog.java:279)
> > E/AndroidRuntime( 5329):        at 
> > android.app.Dialog.access$000(Dialog.java:72)
> > E/AndroidRuntime( 5329):        at android.app.Dialog$1.run(Dialog.java:108)
> > E/AndroidRuntime( 5329):        at 
> > android.app.Dialog.dismiss(Dialog.java:263)
> > E/AndroidRuntime( 5329):        at
> > android.widget.Spinner.onDetachedFromWindow(Spinner.jav
> > a:86)
> > E/AndroidRuntime( 5329):        at
> > android.view.View.dispatchDetachedFromWindow(View.java:
> > 5584)
> > E/AndroidRuntime( 5329):        at
> > android.view.ViewGroup.dispatchDetachedFromWindow(ViewG
> > roup.java:1074)
> > E/AndroidRuntime( 5329):        at
> > android.view.ViewGroup.dispatchDetachedFromWindow(ViewG
>
> > Thanks
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to