开发者

Spinner within Child of ActivityGroup doesn't work

I have a problem with spinner inside activity , that child of Activity group . when I clicke开发者_如何学Pythond 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!


this works fine.

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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜