所以,我正在使用平台Xamarin开发应用程序。然而,一个用户有一个不会消失的烦人的bug。更奇怪的是,该用户是唯一拥有此错误的用户。我无法使用模拟器和物理设备重现这一点,而另一个用户也没有此错误。客户使用三星Galaxy A5(2016)(a5xelte)。搜索崩溃报告后,我发现客户端有此崩溃报告:
android.runtime.JavaProxyThrowable: at ACD.App.Droid.Alert+AlertDialogFragment+<>c__DisplayClass9_0.<HappyAlert>b__0 (System.Object <sender>, System.EventArgs <e>) [0x0001d] in <c345aa7ad2f34bfc8b384470d2386f05>:0
at Android.Views.View+IOnClickListenerImplementor.OnClick (Android.Views.View v) [0x00011] in <e3db7c3b36704d7ea2a7892711a8a46d>:0
at Android.Views.View+IOnClickListenerInvoker.n_OnClick_Landroid_view_View_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_v) [0x0000f] in <e3db7c3b36704d7ea2a7892711a8a46d>:0
at (wrapper dynamic-method) System.Object:209af83e-6acd-4fa8-ae0f-b79f18f9b39f (intptr,intptr,intptr)
at mono.android.view.View_OnClickListenerImplementor.n_onClick (Native Method)
at mono.android.view.View_OnClickListenerImplementor.onClick (View_OnClickListenerImplementor.java:30)
at android.view.View.performClick (View.java:6261)
at android.widget.TextView.performClick (TextView.java:11159)
at android.view.View$PerformClick.run (View.java:23748)
at android.os.Handler.handleCallback (Handler.java:751)
at android.os.Handler.dispatchMessage (Handler.java:95)
at android.os.Looper.loop (Looper.java:154)
at android.app.ActivityThread.main (ActivityThread.java:6776)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1496)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1386)
我的问题是,为什么这个用户有这个错误,而其他用户没有这个错误?我怎么能在将来阻止这样的事情呢?
以下是来自设备的图片:
最后,这里是发生错误的代码:
public void HappyAlert(Android.Views.LayoutInflater inflater, AlertDialog.Builder builder)
{
Android.Views.View secondView = inflater.Inflate(Resource.Layout.HappySliderLayout, null);
builder.SetView(secondView);
TextView title = secondView.FindViewById<TextView>(Resource.Id.Login);
title.Text = Title;
TextView body = secondView.FindViewById<TextView>(Resource.Id.pincodeText);
body.Text = Body;
body.MovementMethod = new Android.Text.Method.ScrollingMovementMethod();
Android.Widget.Button btnNeutral = secondView.FindViewById<Android.Widget.Button>(Resource.Id.btnNeutral);
ImageView imgHappy = secondView.FindViewById<ImageView>(Resource.Id.imgHappy);
ImageView imgSad = secondView.FindViewById<ImageView>(Resource.Id.imgSad);
var happySlider = secondView.FindViewById<SeekBar>(Resource.Id.happinessSlider);
happySlider.Visibility = Android.Views.ViewStates.Visible;
btnNeutral.Text = Buttons.First().Text;
btnNeutral.Click += delegate
{
var car = (StackLayout)Content;
var layoutView = (Xamarin.Forms.AbsoluteLayout)car.Children[1];
var slider = (Slider)layoutView.Children[1];
var totalHappyValue = happySlider.Progress / 10;
slider.Value = totalHappyValue;
CommandsForButtons(Buttons.First());
};
}