gpt4 book ai didi

android - 关于 FragmentTransaction

转载 作者:太空狗 更新时间:2023-10-29 12:39:30 25 4
gpt4 key购买 nike

我在一个 Activity 中有三个 fragment ,并在 Activity 中处理了反压。在一个 fragment 中 back press (CallingFragment) 它加载 DialerFragment因为我在加载 CallingFragement 并提供此日志 时将其添加到后台堆栈。请告诉我为什么会这样?

正在加载调用 fragment :

 void launchCallingFrag(String number, String name ,long time , boolean isongoing,String price )
{
String calleename= name;
if(calleename==null)
calleename=CommonUtility.getContactDisplayNameByNumber(number, context);

callingScreenFragment.setNumber( number,calleename ,time,isongoing , price);
ft = getSupportFragmentManager().beginTransaction();
ft.replace(R.id.dial_fragment, callingScreenFragment, CALLING_FRAGMENT_TAG);

dialerFragment = (DialerFragment)getSupportFragmentManager().findFragmentByTag(DIALER_FRAGMENT_TAG);

ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);

ft.addToBackStack(DIALER_FRAGMENT_TAG);


ft.commit();
overridePendingTransition(R.anim.animation1, R.anim.animation2);

}

背压:

  @Override
public void onBackPressed() {
Log.e("back press called ",""+getSupportFragmentManager().getBackStackEntryCount());
dialerFragment = (DialerFragment)getSupportFragmentManager().findFragmentByTag(DIALER_FRAGMENT_TAG);
if (dialerFragment!=null&&dialerFragment.isVisible()) {
// add your code here
Log.e("dialer fragment","dialer fragment ");
dialerFragment.onBackPress();
}
else {

callingScreenFragment = (CallingScreenFragment) getSupportFragmentManager().findFragmentByTag(CALLING_FRAGMENT_TAG);
if (callingScreenFragment!=null&&callingScreenFragment.isVisible()) {

Log.e("calling fragment", "calling fragment ");

callingScreenFragment.onBackPress(fromNotification);

}
else {
recentDetailFragment = (RecentDetailFragment) getSupportFragmentManager().findFragmentByTag(LOG_DETAILS_FRAGMENT_TAG);
if (recentDetailFragment!=null&&recentDetailFragment.isVisible()) {
Log.e("recent fragment","recent fragment ");
recentDetailFragment.onBackPress();
}
else {
super.onBackPressed();
}
}

}

日志:

 02-05 17:17:04.967  10280-10280/com.myapp E/dalvikvm﹕ Could not find class 'android.transition.Transition', referenced from method android.support.v4.app.FragmentTransitionCompat21.addTargets
02-05 17:17:04.967 10280-10280/com.myapp W/dalvikvm﹕ VFY: unable to resolve check-cast 1450 (Landroid/transition/Transition;) in Landroid/support/v4/app/FragmentTransitionCompat21;
02-05 17:17:04.967 10280-10280/com.myapp E/dalvikvm﹕ Could not find class 'android.transition.Transition', referenced from method android.support.v4.app.FragmentTransitionCompat21.addTransitionTargets
02-05 17:17:04.967 10280-10280/com.myapp W/dalvikvm﹕ VFY: unable to resolve check-cast 1450 (Landroid/transition/Transition;) in Landroid/support/v4/app/FragmentTransitionCompat21;
02-05 17:17:04.967 10280-10280/com.myapp E/dalvikvm﹕ Could not find class 'android.transition.Transition', referenced from method android.support.v4.app.FragmentTransitionCompat21.beginDelayedTransition
02-05 17:17:04.967 10280-10280/com.myapp W/dalvikvm﹕ VFY: unable to resolve check-cast 1450 (Landroid/transition/Transition;) in Landroid/support/v4/app/FragmentTransitionCompat21;
02-05 17:17:04.967 10280-10280/com.myapp E/dalvikvm﹕ Could not find class 'android.transition.Transition', referenced from method android.support.v4.app.FragmentTransitionCompat21.captureExitingViews
02-05 17:17:04.967 10280-10280/com.myapp W/dalvikvm﹕ VFY: unable to resolve check-cast 1450 (Landroid/transition/Transition;) in Landroid/support/v4/app/FragmentTransitionCompat21;
02-05 17:17:04.967 10280-10280/com.myapp W/dalvikvm﹕ VFY: unable to resolve virtual method 12194: Landroid/view/ViewGroup;.isTransitionGroup ()Z
02-05 17:17:04.967 10280-10280/com.myapp E/dalvikvm﹕ Could not find class 'android.transition.Transition', referenced from method android.support.v4.app.FragmentTransitionCompat21.cleanupTransitions
02-05 17:17:04.967 10280-10280/com.myapp W/dalvikvm﹕ VFY: unable to resolve check-cast 1450 (Landroid/transition/Transition;) in Landroid/support/v4/app/FragmentTransitionCompat21;
02-05 17:17:04.967 10280-10280/com.myapp E/dalvikvm﹕ Could not find class 'android.transition.Transition', referenced from method android.support.v4.app.FragmentTransitionCompat21.cloneTransition
02-05 17:17:04.967 10280-10280/com.myapp W/dalvikvm﹕ VFY: unable to resolve check-cast 1450 (Landroid/transition/Transition;) in Landroid/support/v4/app/FragmentTransitionCompat21;
02-05 17:17:04.977 10280-10280/com.myapp E/dalvikvm﹕ Could not find class 'android.transition.Transition', referenced from method android.support.v4.app.FragmentTransitionCompat21.excludeTarget
02-05 17:17:04.977 10280-10280/com.myapp W/dalvikvm﹕ VFY: unable to resolve check-cast 1450 (Landroid/transition/Transition;) in Landroid/support/v4/app/FragmentTransitionCompat21;
02-05 17:17:04.977 10280-10280/com.myapp W/dalvikvm﹕ VFY: unable to resolve virtual method 12022: Landroid/view/View;.getTransitionName ()Ljava/lang/String;
02-05 17:17:04.977 10280-10280/com.myapp W/dalvikvm﹕ VFY: unable to resolve virtual method 12022: Landroid/view/View;.getTransitionName ()Ljava/lang/String;
02-05 17:17:04.977 10280-10280/com.myapp E/dalvikvm﹕ Could not find class 'android.transition.Transition', referenced from method android.support.v4.app.FragmentTransitionCompat21.mergeTransitions
02-05 17:17:04.977 10280-10280/com.myapp W/dalvikvm﹕ VFY: unable to resolve check-cast 1450 (Landroid/transition/Transition;) in Landroid/support/v4/app/FragmentTransitionCompat21;
02-05 17:17:04.977 10280-10280/com.myapp E/dalvikvm﹕ Could not find class 'android.transition.Transition', referenced from method android.support.v4.app.FragmentTransitionCompat21.removeTargets
02-05 17:17:04.977 10280-10280/com.myapp W/dalvikvm﹕ VFY: unable to resolve check-cast 1450 (Landroid/transition/Transition;) in Landroid/support/v4/app/FragmentTransitionCompat21;
02-05 17:17:04.977 10280-10280/com.myapp E/dalvikvm﹕ Could not find class 'android.transition.Transition', referenced from method android.support.v4.app.FragmentTransitionCompat21.setEpicenter
02-05 17:17:04.977 10280-10280/com.myapp W/dalvikvm﹕ VFY: unable to resolve check-cast 1450 (Landroid/transition/Transition;) in Landroid/support/v4/app/FragmentTransitionCompat21;
02-05 17:17:04.977 10280-10280/com.myapp W/dalvikvm﹕ VFY: unable to find class referenced in signature (Landroid/transition/Transition;)
02-05 17:17:04.977 10280-10280/com.myapp W/dalvikvm﹕ Unable to resolve superclass of Landroid/support/v4/app/FragmentTransitionCompat21$3; (1449)
02-05 17:17:04.977 10280-10280/com.myapp W/dalvikvm﹕ Link of class 'Landroid/support/v4/app/FragmentTransitionCompat21$3;' failed
02-05 17:17:04.977 10280-10280/com.myapp E/dalvikvm﹕ Could not find class 'android.support.v4.app.FragmentTransitionCompat21$3', referenced from method android.support.v4.app.FragmentTransitionCompat21.setSharedElementEpicenter
02-05 17:17:04.977 10280-10280/com.myapp W/dalvikvm﹕ VFY: unable to resolve new-instance 422 (Landroid/support/v4/app/FragmentTransitionCompat21$3;) in Landroid/support/v4/app/FragmentTransitionCompat21;
02-05 17:17:04.987 10280-10280/com.myapp W/dalvikvm﹕ Unable to resolve superclass of Landroid/support/v4/app/FragmentTransitionCompat21$1; (1449)
02-05 17:17:04.987 10280-10280/com.myapp W/dalvikvm﹕ Link of class 'Landroid/support/v4/app/FragmentTransitionCompat21$1;' failed
02-05 17:17:04.987 10280-10280/com.myapp W/dalvikvm﹕ Unable to resolve superclass of Landroid/support/v4/app/FragmentTransitionCompat21$3; (1449)
02-05 17:17:04.987 10280-10280/com.myapp W/dalvikvm﹕ Link of class 'Landroid/support/v4/app/FragmentTransitionCompat21$3;' failed

最佳答案

不幸的是,这是由于 android.support.v4 库中的错误尚未解决(截至本回答之日)。

本质上,支持库使用 API 级别 19 和 21 API,即使在没有足够高 API 级别的设备上运行时也是如此。这是一个非常严重(甚至令人震惊)的错误,因为 Android 支持库的全部目的是使应用程序免受 API 级别差异的影响!

在您的情况下,您显然在 API 级别低于 19 的设备上运行,这是整个 android.transition 的时候包被引入。

相关的 Android 问题是:7767089244 .您可能想访问这些问题并给它们加注星标,和/或添加一个新问题。

关于android - 关于 FragmentTransaction ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28343537/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com