1

I have a problem with spinner inside activity , that child of Activity group . when I clicked on spinner , that isn't expanded and "Force Close" window appears I was checked Logcat and catch "BadTokenException ", see below :

http://i227.photobucket.com/albums/dd299/lavender-90/stackflow.jpg

my XML:

<Spinner  
    android:id="@+id/aroundSP"  
    android:layout_height="wrap_content"  
    android:prompt="@string/touraround"
    android:layout_width="fill_parent"  
    android:entries="@array/Triparound"
    android:layout_marginTop="250dip" 
    android:layout_marginLeft="4dip"
    style="@style/ContentTitle">
</Spinner>

Thanks everyone!

ferostar
  • 7,074
  • 7
  • 38
  • 61
Haifa
  • 11
  • 1
  • try looking here http://stackoverflow.com/questions/4568494/error-while-placing-a-spinner-inside-activity-group – trio Jul 07 '11 at 13:41

2 Answers2

2

this works fine.

View viewToLoad = LayoutInflater.from(this.getParent()).inflate(
                    R.layout.marketlist, null);
            this.setContentView(viewToLoad);
1

If you are using context anywhere then you have to pass getParent() context because you are in a child of activity group.

Paresh Mayani
  • 127,700
  • 71
  • 241
  • 295