问题描述
我有4个片段,即A B C D。现在,当我更多的从A到B,我添加了一个向后堆栈。比我谨从B到C,而不增加回堆栈。比我谨从C到D无添加备份堆栈。现在回到preSS我重定向到一个。
I am having 4 fragments namely A B C D.Now When i more from A to B, I add A to back stack.than I move from B to C without adding to back stack.than I move from C to D without adding to back stack.now on back press I am redirected to A.
我再次重复,直到D和现在,当我回到preSS,它显示片段A和再次重定向我片段D和再次返回preSS,它退出应用程序。
Again I repeat till D and now when I back press, It displays fragment A and again redirects me to fragment D and on Back press again, it exits app.
我希望它像从D背面preSS它应该总是让我去A
I want it to be like On back press from D It should always get me to A
谁能帮助?
这里是code的
我在logcat中得到这个
I am getting this in logcat
02-06 13:31:19.395 26930-26930 / com.example.user.fragmentbackstackexample I / dalvikvm:找不到方法android.view.ViewGroup.isTransitionGroup,从方法引用android.support.v4.app.FragmentTransitionCompat21.captureTransitioningViews
02-06 13:31:19.395 26930-26930/com.example.user.fragmentbackstackexample I/dalvikvm﹕ Could not find method android.view.ViewGroup.isTransitionGroup, referenced from method android.support.v4.app.FragmentTransitionCompat21.captureTransitioningViews
02-06 13:31:19.395 26930-26930 / com.example.user.fragmentbackstackexample W / dalvikvm:VFY:无法解析虚方法11340:Landroid /查看/ ViewGroup中; .isTransitionGroup()z
02-06 13:31:19.395 26930-26930/com.example.user.fragmentbackstackexample W/dalvikvm﹕ VFY: unable to resolve virtual method 11340: Landroid/view/ViewGroup;.isTransitionGroup ()Z
02-06 13:31:19.395 26930-26930 / com.example.user.fragmentbackstackexample I / dalvikvm:找不到方法android.view.View.getTransitionName,从方法android.support.v4.app.FragmentTransitionCompat21引用.findNamedViews
02-06 13:31:19.395 26930-26930/com.example.user.fragmentbackstackexample I/dalvikvm﹕ Could not find method android.view.View.getTransitionName, referenced from method android.support.v4.app.FragmentTransitionCompat21.findNamedViews
02-06 13:31:19.395 26930-26930 / com.example.user.fragmentbackstackexample W / dalvikvm:VFY:无法解析虚方法11182:Landroid /视图/视图; .getTransitionName()Ljava /朗/字符串;
02-06 13:31:19.395 26930-26930/com.example.user.fragmentbackstackexample W/dalvikvm﹕ VFY: unable to resolve virtual method 11182: Landroid/view/View;.getTransitionName ()Ljava/lang/String;
02-06 13:31:19.405 26930-26930 / com.example.user.fragmentbackstackexample I / dalvikvm:找不到方法android.view.View.getTransitionName,从方法android.support.v4.app.FragmentTransitionCompat21引用.getTransitionName
02-06 13:31:19.405 26930-26930/com.example.user.fragmentbackstackexample I/dalvikvm﹕ Could not find method android.view.View.getTransitionName, referenced from method android.support.v4.app.FragmentTransitionCompat21.getTransitionName
02-06 13:31:19.405 26930-26930 / com.example.user.fragmentbackstackexample W / dalvikvm:VFY:无法解析虚方法11182:Landroid /视图/视图; .getTransitionName()Ljava /朗/字符串;
02-06 13:31:19.405 26930-26930/com.example.user.fragmentbackstackexample W/dalvikvm﹕ VFY: unable to resolve virtual method 11182: Landroid/view/View;.getTransitionName ()Ljava/lang/String;
02-06 13:31:19.415 26930-26930 / com.example.user.fragmentbackstackexample W / dalvikvm:无法解析的超Landroid /支持/ V4 / APP / FragmentTransitionCompat21 $ 1; (1303)
02-06 13:31:19.415 26930-26930/com.example.user.fragmentbackstackexample W/dalvikvm﹕ Unable to resolve superclass of Landroid/support/v4/app/FragmentTransitionCompat21$1; (1303)
02-06 13:31:19.415 26930-26930 / com.example.user.fragmentbackstackexample W / dalvikvm:类链接Landroid /支持/ V4 / APP / FragmentTransitionCompat21 $ 1;'失败
02-06 13:31:19.415 26930-26930/com.example.user.fragmentbackstackexample W/dalvikvm﹕ Link of class 'Landroid/support/v4/app/FragmentTransitionCompat21$1;' failed
02-06 13:31:19.415 26930-26930 / com.example.user.fragmentbackstackexample E / dalvikvm:找不到类的android.support.v4.app.FragmentTransitionCompat21 $ 1',从方法引用android.support.v4.app.FragmentTransitionCompat21.setEpicenter
02-06 13:31:19.415 26930-26930/com.example.user.fragmentbackstackexample E/dalvikvm﹕ Could not find class 'android.support.v4.app.FragmentTransitionCompat21$1', referenced from methodandroid.support.v4.app.FragmentTransitionCompat21.setEpicenter
02-06 13:31:19.425 26930-26930 / com.example.user.fragmentbackstackexample W / dalvikvm:VFY:无法解析新的实例294(Landroid /支持/ V4 / APP / FragmentTransitionCompat21 $ 1;)在Landroid /支持/ V4 / APP / FragmentTransitionCompat21;
02-06 13:31:19.425 26930-26930/com.example.user.fragmentbackstackexample W/dalvikvm﹕ VFY: unable to resolve new-instance 294(Landroid/support/v4/app/FragmentTransitionCompat21$1;) in Landroid/support/v4/app/FragmentTransitionCompat21;
02-06 13:31:19.425 26930-26930 / com.example.user.fragmentbackstackexample W / dalvikvm:无法解析的超Landroid /支持/ V4 / APP / FragmentTransitionCompat21 $ 3; (1303)
02-06 13:31:19.425 26930-26930/com.example.user.fragmentbackstackexample W/dalvikvm﹕ Unable to resolve superclass of Landroid/support/v4/app/FragmentTransitionCompat21$3; (1303)
02-06 13:31:19.425 26930-26930 / com.example.user.fragmentbackstackexample W / dalvikvm:类链接Landroid /支持/ V4 / APP / FragmentTransitionCompat21 $ 3;'失败
02-06 13:31:19.425 26930-26930/com.example.user.fragmentbackstackexample W/dalvikvm﹕ Link of class 'Landroid/support/v4/app/FragmentTransitionCompat21$3;' failed
02-06 13:31:19.435 26930-26930 / com.example.user.fragmentbackstackexample E / dalvikvm:找不到类android.support.v4.app.FragmentTransitionCompat21 $ 3',从方法android.support引用。 v4.app.FragmentTransitionCompat21.setSharedElementEpicenter
02-06 13:31:19.435 26930-26930/com.example.user.fragmentbackstackexample E/dalvikvm﹕ Could not find class 'android.support.v4.app.FragmentTransitionCompat21$3', referenced from method android.support.v4.app.FragmentTransitionCompat21.setSharedElementEpicenter
02-06 13:31:19.435 26930-26930 / com.example.user.fragmentbackstackexample W / dalvikvm:VFY:无法解析新的实例296(Landroid /支持/ V4 / APP / FragmentTransitionCompat21 $ 3;)的Landroid /支持/ V4 / APP / FragmentTransitionCompat21;
02-06 13:31:19.435 26930-26930/com.example.user.fragmentbackstackexample W/dalvikvm﹕ VFY: unable to resolve new-instance 296 (Landroid/support/v4/app/FragmentTransitionCompat21$3;) in Landroid/support/v4/app/FragmentTransitionCompat21;
02-06 13:31:19.435 26930-26930 / com.example.user.fragmentbackstackexample W / dalvikvm:无法解析的超Landroid /支持/ V4 / APP / FragmentTransitionCompat21 $ 1; (1303)
02-06 13:31:19.435 26930-26930/com.example.user.fragmentbackstackexample W/dalvikvm﹕ Unable to resolve superclass of Landroid/support/v4/app/FragmentTransitionCompat21$1; (1303)
02-06 13:31:19.435 26930-26930 / com.example.user.fragmentbackstackexample W / dalvikvm:类链接Landroid /支持/ V4 / APP / FragmentTransitionCompat21 $ 1;'失败
02-06 13:31:19.435 26930-26930/com.example.user.fragmentbackstackexample W/dalvikvm﹕ Link of class 'Landroid/support/v4/app/FragmentTransitionCompat21$1;' failed
02-06 13:31:19.445 26930-26930 / com.example.user.fragmentbackstackexample W / dalvikvm:无法解析的超Landroid /支持/ V4 / APP / FragmentTransitionCompat21 $ 3; (1303)
02-06 13:31:19.445 26930-26930/com.example.user.fragmentbackstackexample W/dalvikvm﹕ Unable to resolve superclass of Landroid/support/v4/app/FragmentTransitionCompat21$3; (1303)
02-06 13:31:19.445 26930-26930 / com.example.user.fragmentbackstackexample W / dalvikvm:类链接Landroid /支持/ V4 / APP / FragmentTransitionCompat21 $ 3;'失败
02-06 13:31:19.445 26930-26930/com.example.user.fragmentbackstackexample W/dalvikvm﹕ Link of class 'Landroid/support/v4/app/FragmentTransitionCompat21$3;' failed
推荐答案
只是删除 super.onBack pressed();
从codeS
Just remove super.onBackPressed();
from your codes
这篇关于Android的碎片回到preSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!