问题描述
描述: 我要继承环信的红包功能,努力了一天,好吧实现了调出红包界面,提示我扣款成功(京东支付)。我在原来的web页面返回到聊天窗口。还没看到就蹦了。异常没拿到。然后我再次进入聊天窗口(对象环信小助手)。我点输入框。就有了下面的异常。(还有个问题看完这个看下面的) 05-12 16:29:47.072 23811-23811/com.easemob.chatuidemo D/AndroidRuntime: Shutting down VM05-12 16:29:47.111 23811-23811/com.easemob.chatuidemo E/AndroidRuntime: FATAL EXCEPTION: main Process: com.easemob.chatuidemo, PID: 23811 java.lang.ArrayIndexOutOfBoundsException: length=19; index=20 at android.widget.AbsListView$RecycleBin.addScrapView(AbsListView.java:6726) at android.widget.ListView.layoutChildren(ListView.java:1644) at android.widget.AbsListView.onLayout(AbsListView.java:2148) at android.view.View.layout(View.java:16653) at android.view.ViewGroup.layout(ViewGroup.java:5438) at android.support.v4.widget.SwipeRefreshLayout.onLayout(SwipeRefreshLayout.java:584) at android.view.View.layout(View.java:16653) at android.view.ViewGroup.layout(ViewGroup.java:5438) at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1080) at android.view.View.layout(View.java:16653) at android.view.ViewGroup.layout(ViewGroup.java:5438) at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1080) at android.view.View.layout(View.java:16653) at android.view.ViewGroup.layout(ViewGroup.java:5438) at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1080) at android.view.View.layout(View.java:16653) at android.view.ViewGroup.layout(ViewGroup.java:5438) at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1080) at android.view.View.layout(View.java:16653) at android.view.ViewGroup.layout(ViewGroup.java:5438) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336) at android.widget.FrameLayout.onLayout(FrameLayout.java:273) at android.view.View.layout(View.java:16653) at android.view.ViewGroup.layout(ViewGroup.java:5438) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336) at android.widget.FrameLayout.onLayout(FrameLayout.java:273) at android.view.View.layout(View.java:16653) at android.view.ViewGroup.layout(ViewGroup.java:5438) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586) at android.widget.LinearLayout.onLayout(LinearLayout.java:1495) at android.view.View.layout(View.java:16653) at android.view.ViewGroup.layout(ViewGroup.java:5438) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336) at android.widget.FrameLayout.onLayout(FrameLayout.java:273) at com.android.internal.policy.PhoneWindow$DecorView.onLayout(PhoneWindow.java:2678) at android.view.View.layout(View.java:16653) at android.view.ViewGroup.layout(ViewGroup.java:5438) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2191) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1951) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1127) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6038) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:860) at android.view.Choreographer.doCallbacks(Choreographer.java:672) at android.view.Choreographer.doFrame(Choreographer.java:608) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:846) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5432) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:735) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)05-12 16:29:48.761 23811-23811/com.easemob.chatuidemo I/Process: Sending signal. PID: 23811 SIG: 9 我点击红包(我发的)进去。返回来之后又给我异常了。是在纠结。知道是数组越界,但是不出在哪里,怎么解 下面是返回的时候的 log 05-12 16:38:17.350 27724-27724/com.easemob.chatuidemo D/lzan13: ChatFragment - onActivityResult - 1605-12 16:38:17.389 27724-27724/com.easemob.chatuidemo D/AndroidRuntime: Shutting down VM --------- beginning of crash05-12 16:38:17.430 27724-27724/com.easemob.chatuidemo E/AndroidRuntime: FATAL EXCEPTION: main Process: com.easemob.chatuidemo, PID: 27724 java.lang.ArrayIndexOutOfBoundsException: length=19; index=20 at android.widget.AbsListView$RecycleBin.addScrapView(AbsListView.java:6726) at android.widget.ListView.layoutChildren(ListView.java:1644) at android.widget.AbsListView.onLayout(AbsListView.java:2148) at android.view.View.layout(View.java:16653) at android.view.ViewGroup.layout(ViewGroup.java:5438) at android.support.v4.widget.SwipeRefreshLayout.onLayout(SwipeRefreshLayout.java:584) at android.view.View.layout(View.java:16653) at android.view.ViewGroup.layout(ViewGroup.java:5438) at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1080) at android.view.View.layout(View.java:16653) at android.view.ViewGroup.layout(ViewGroup.java:5438) at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1080) at android.view.View.layout(View.java:16653) at android.view.ViewGroup.layout(ViewGroup.java:5438) at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1080) at android.view.View.layout(View.java:16653) at android.view.ViewGroup.layout(ViewGroup.java:5438) at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1080) at android.view.View.layout(View.java:16653) at android.view.ViewGroup.layout(ViewGroup.java:5438) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336) at android.widget.FrameLayout.onLayout(FrameLayout.java:273) at android.view.View.layout(View.java:16653) at android.view.ViewGroup.layout(ViewGroup.java:5438) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336) at android.widget.FrameLayout.onLayout(FrameLayout.java:273) at android.view.View.layout(View.java:16653) at android.view.ViewGroup.layout(ViewGroup.java:5438) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586) at android.widget.LinearLayout.onLayout(LinearLayout.java:1495) at android.view.View.layout(View.java:16653) at android.view.ViewGroup.layout(ViewGroup.java:5438) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336) at android.widget.FrameLayout.onLayout(FrameLayout.java:273) at com.android.internal.policy.PhoneWindow$DecorView.onLayout(PhoneWindow.java:2678) at android.view.View.layout(View.java:16653) at android.view.ViewGroup.layout(ViewGroup.java:5438) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2191) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1951) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1127) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6038) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:860) at android.view.Choreographer.doCallbacks(Choreographer.java:672) at android.view.Choreographer.doFrame(Choreographer.java:608) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:846) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5432) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:735) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)05-12 16:38:19.619 27724-331/com.easemob.chatuidemo W/Bitmap: Called getConfig() on a recycle()'d bitmap! This is undefined behavior!
解决方案
问题解决,API中有一个点没有提示,现在给大家补上。
解决方案二:
不错,赞。 最近会发布群红包功能,期待吧