java.util.stack pop方法在Xamarin android项目中不起作用

时间:2019-04-19 11:14:06

标签: xamarin.android stack

您好,我尝试在xamarin android项目中的活动中使用Java.Util.Stack的每个人,但是不知何故,堆栈的Pop()方法无法按预期工作,并且stack.Peek()始终在弹出后应该删除的顶部。当我对这种行为感到困惑时,需要帮助

if (mStackFragments.Count > 1)
                {
                    if (mStackFragments.Peek() == explorerFragment) //this condition is evaluated to true and hence an item should be poped and lc is assigned that value too (confirmed by debugging)
                    {
                        int lc=(int)chapterStack.Pop();
                        int cnt=(int)chapterStack.Size();
                    }
                    mStackFragments.Pop();
                    SupportFragment frag = mStackFragments.Pop();
                    if (frag == chaptersFragment)
                    {
                        if (chapterfiltertext != "")
                        {
                            item.ExpandActionView();
                            sssearchview.SetQuery(chapterfiltertext, false);
                            mainview.Animate().Alpha(1f).SetListener(null);
                        }
                    }
                    if (frag == explorerFragment)
                    {
                        int pek = (int)chapterStack.Peek(); //always shows the item that should have been removed
                        chapterspinner.SetSelection((int)chapterStack.Peek());
                    }
                        ShowFragment(frag);
                }

0 个答案:

没有答案