Spinner inside Child of ActivityGroup not working

I have a problem with the inner spinner function, this child of an action group. when I clicked on spinner, it was not expanded, and the window "Force Close" appears. I was checked by Logcat and caught a "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!

+1
source share
2 answers

it works great.

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

If you use the context anywhere, then you need to pass the getParent() context because you have a child of the action group.

+1
source

Source: https://habr.com/ru/post/1400570/


All Articles