本文介绍了OnSaveInstanceState中的ViewPagerIndicator.CirclePageIndicator崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个带有ViewPager和CirclePageIndicator的活动.问题是,如果我从该页面拨打电话,活动将在OnSaveInstanceState中崩溃.

So I have this activity with a ViewPager and a CirclePageIndicator.The problem is that if I make a phone call from this page, the activity crashes in OnSaveInstanceState.

该日志包含以下消息:System.MethodAccessException: Method '(wrapper dynamic-method) object:dynamic_callback_0 (intptr,intptr)' is inaccessible from method 'ViewPagerIndicator.CirclePageIndicator/SavedState:InitializeCreator ()'

The log contains the following message : System.MethodAccessException: Method '(wrapper dynamic-method) object:dynamic_callback_0 (intptr,intptr)' is inaccessible from method 'ViewPagerIndicator.CirclePageIndicator/SavedState:InitializeCreator ()'

页面非常简单:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/transparent">
    (...)
    <android.support.v4.view.ViewPager
        android:id="@+id/advicesViewPager"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:background="@android:color/transparent" />
    <viewpagerindicator.CirclePageIndicator
        android:layout_width="match_parent"
        android:layout_weight="0"
        android:layout_height="20dp"
        android:id="@+id/pageIndicator"
        android:layout_gravity="bottom"
        android:layout_marginBottom="5dip"
        android:background="@android:color/transparent" />
</LinearLayout>

现在,我在OnSaveInstanceState中没有做任何特定的事情:

and for now I don't do anything specific in OnSaveInstanceState :

protected override void OnSaveInstanceState(Bundle outState) {
    base.OnSaveInstanceState(outState);
}

有人有想法吗?这是ViewPager中的错误吗?这是更完整的崩溃日志:

Does anyone have an idea? Is it a bug in ViewPager?Here's the more complete crash log :

10-27 11:27:39.397: I/MonoDroid(21152): UNHANDLED EXCEPTION:
10-27 11:27:39.412: I/MonoDroid(21152): System.MethodAccessException: Method `(wrapper dynamic-method) object:dynamic_callback_0 (intptr,intptr)' is inaccessible from method `ViewPagerIndicator.CirclePageIndicator/SavedState:InitializeCreator ()'
10-27 11:27:39.412: I/MonoDroid(21152):   at (wrapper managed-to-native) Java.Interop.NativeMethods:java_interop_jnienv_alloc_object (intptr,intptr&,intptr)
10-27 11:27:39.412: I/MonoDroid(21152):   at Java.Interop.JniEnvironment+Object.AllocObject (Java.Interop.JniObjectReference type) [0x0002b] in <6404a45abb2c4b308b3171b7d4654a9c>:0
10-27 11:27:39.412: I/MonoDroid(21152):   at Java.Interop.JniType.AllocObject () [0x0000d] in <6404a45abb2c4b308b3171b7d4654a9c>:0
10-27 11:27:39.412: I/MonoDroid(21152):   at Java.Interop.JniPeerMembers+JniInstanceMethods.StartCreateInstance (System.String constructorSignature, System.Type declaringType, Java.Interop.JniArgumentValue* parameters) [0x0004e] in <6404a45abb2c4b308b3171b7d4654a9c>:0
10-27 11:27:39.412: I/MonoDroid(21152):   at Android.Views.View+BaseSavedState..ctor (Android.OS.IParcelable superState) [0x00068] in <b89cc247a96c4a08b3f4d799211a17e9>:0
10-27 11:27:39.412: I/MonoDroid(21152):   at ViewPagerIndicator.CirclePageIndicator+SavedState..ctor (Android.OS.IParcelable superState) [0x00000] in <6082434bddad42ed98ca380b4342ff37>:0
10-27 11:27:39.412: I/MonoDroid(21152):   at ViewPagerIndicator.CirclePageIndicator.OnSaveInstanceState () [0x00006] in <6082434bddad42ed98ca380b4342ff37>:0
10-27 11:27:39.413: I/MonoDroid(21152):   at Android.Views.View.n_OnSaveInstanceState (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in <b89cc247a96c4a08b3f4d799211a17e9>:0
10-27 11:27:39.413: I/MonoDroid(21152):   at (wrapper dynamic-method) System.Object:79b91d2d-6d99-430c-aadf-8224184bf0d3 (intptr,intptr)
10-27 11:27:39.635: W/google-breakpad(21152): ### ### ### ### ### ### ### ### ### ### ### ### ###
10-27 11:27:39.636: W/google-breakpad(21152): Chrome build fingerprint:
10-27 11:27:39.636: W/google-breakpad(21152): 1.0
10-27 11:27:39.636: W/google-breakpad(21152): 1
10-27 11:27:39.636: W/google-breakpad(21152): ### ### ### ### ### ### ### ### ### ### ### ### ###
10-27 11:27:39.636: E/mono-rt(21152): Stacktrace:
10-27 11:27:39.636: E/mono-rt(21152):   at <unknown> <0xffffffff>
10-27 11:27:39.636: E/mono-rt(21152):   at (wrapper managed-to-native) Java.Interop.NativeMethods.java_interop_jnienv_find_class (intptr,intptr&,string) <0x00043>
10-27 11:27:39.636: E/mono-rt(21152):   at Java.Interop.JniEnvironment/Types.FindClass (string) <0x000a7>
10-27 11:27:39.636: E/mono-rt(21152):   at Java.Interop.JniType..ctor (string) <0x0002b>
10-27 11:27:39.636: E/mono-rt(21152):   at Java.Interop.JniPeerMembers/JniInstanceMethods..ctor (System.Type) <0x000eb>
10-27 11:27:39.636: E/mono-rt(21152):   at Java.Interop.JniPeerMembers/JniInstanceMethods.GetConstructorsForType (System.Type) <0x00097>
10-27 11:27:39.636: E/mono-rt(21152):   at Java.Interop.JniPeerMembers/JniInstanceMethods.StartCreateInstance (string,System.Type,Java.Interop.JniArgumentValue*) <0x0009b>
10-27 11:27:39.636: E/mono-rt(21152):   at Java.Lang.Throwable..ctor (string) <0x0016b>
10-27 11:27:39.637: E/mono-rt(21152):   at Android.Runtime.JavaProxyThrowable..ctor (System.Exception) <0x0001f>
10-27 11:27:39.637: E/mono-rt(21152):   at Java.Lang.Throwable.FromException (System.Exception) <0x0009f>
10-27 11:27:39.637: E/mono-rt(21152):   at Android.Runtime.AndroidEnvironment.UnhandledException (System.Exception) <0x00177>
10-27 11:27:39.637: E/mono-rt(21152):   at (wrapper dynamic-method) object.79b91d2d-6d99-430c-aadf-8224184bf0d3 (intptr,intptr) <0x00063>
10-27 11:27:39.637: E/mono-rt(21152):   at (wrapper native-to-managed) object.79b91d2d-6d99-430c-aadf-8224184bf0d3 (intptr,intptr) <0x000b3>
10-27 11:27:39.637: E/mono-rt(21152):   at <unknown> <0xffffffff>
10-27 11:27:39.637: E/mono-rt(21152):   at (wrapper managed-to-native) Java.Interop.NativeMethods.java_interop_jnienv_call_nonvirtual_void_method_a (intptr,intptr&,intptr,intptr,intptr,Java.Interop.JniArgumentValue*) <0x00057>
10-27 11:27:39.637: E/mono-rt(21152):   at Java.Interop.JniEnvironment/InstanceMethods.CallNonvirtualVoidMethod (Java.Interop.JniObjectReference,Java.Interop.JniObjectReference,Java.Interop.JniMethodInfo,Java.Interop.JniArgumentValue*) <0x000ab>
10-27 11:27:39.637: E/mono-rt(21152):   at Java.Interop.JniPeerMembers/JniInstanceMethods.InvokeVirtualVoidMethod (string,Java.Interop.IJavaPeerable,Java.Interop.JniArgumentValue*) <0x00133>
10-27 11:27:39.637: E/mono-rt(21152):   at Android.App.Activity.OnSaveInstanceState (Android.OS.Bundle) <0x0014b>
10-27 11:27:39.637: E/mono-rt(21152):   at WheezMe.Droid.WheezHelpAdvicesActivity.OnSaveInstanceState (Android.OS.Bundle) <0x0001b>
10-27 11:27:39.637: E/mono-rt(21152):   at Android.App.Activity.n_OnSaveInstanceState_Landroid_os_Bundle_ (intptr,intptr,intptr) <0x0005b>
10-27 11:27:39.637: E/mono-rt(21152):   at (wrapper dynamic-method) object.de7a5f24-dc6e-4938-89c6-95b6aa716a51 (intptr,intptr,intptr) <0x00043>
10-27 11:27:39.637: E/mono-rt(21152):   at (wrapper native-to-managed) object.de7a5f24-dc6e-4938-89c6-95b6aa716a51 (intptr,intptr,intptr) <0x000b3>
10-27 11:27:39.637: E/mono-rt(21152): Attempting native Android stacktrace:

预先感谢

推荐答案

似乎是CirclePageIndicator中的错误.也许链接到这一个.如果我设置

Seems to be a bug in CirclePageIndicator. Maybe linked to this one.If I set

pageIndicator.SaveEnabled = false;

然后崩溃不再发生

这篇关于OnSaveInstanceState中的ViewPagerIndicator.CirclePageIndicator崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-14 20:12