请选择 进入手机版 | 继续访问电脑版
查看: 261|回复: 1

Android深度定制UI,设置单聊报异常

[复制链接]

1

主题

1

帖子

5

积分

云客

Rank: 1

积分
5
发表于 2018-6-4 15:58:25 | 显示全部楼层 |阅读模式
调用下面方法时频繁报错
NimUIKit.startChatting(context, account, SessionTypeEnum.P2P, sessionCustomization);


private void UIKitPanel(String account) {

NimUIKit.startChatting(this, account, SessionTypeEnum.P2P, getsessionCustomization(), null);

}

/**
* 封装聊天右侧按钮
* @return
*/
private SessionCustomization getsessionCustomization() {
SessionCustomization sessionCustomization = new SessionCustomization();
ArrayList<SessionCustomization.OptionsButton> buttons = new ArrayList<>();
//定义右侧按钮
SessionCustomization.OptionsButton cloudMsgButton = new SessionCustomization.OptionsButton() {
@Override
public void onClick(Context context, View view, String sessionId) {
Toast.makeText(GoodDetailActivity.this, "测试", Toast.LENGTH_SHORT).show();
}
};

cloudMsgButton.iconId = R.drawable.ic_shopcar;
buttons.add(cloudMsgButton);
sessionCustomization.buttons = buttons;

return sessionCustomization;
}
异常信息:

java.lang.RuntimeException: Parcelable encountered IOException writing serializable object (name = com.netease.nim.uikit.api.model.session.SessionCustomization) at android.os.Parcel.writeSerializable(Parcel.java:1527) at android.os.Parcel.writeValue(Parcel.java:1475) at android.os.Parcel.writeArrayMapInternal(Parcel.java:724) at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1408) at android.os.Bundle.writeToParcel(Bundle.java:1157) at android.os.Parcel.writeBundle(Parcel.java:764) at android.content.Intent.writeToParcel(Intent.java:8687) at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:3082) at android.app.Instrumentation.execStartActivity(Instrumentation.java:1518) at android.app.Activity.startActivityForResult(Activity.java:4225) at android.support.v4.app.BaseFragmentActivityApi16.startActivityForResult(BaseFragmentActivityApi16.java:54) at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:67) at android.app.Activity.startActivityForResult(Activity.java:4183) at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:732) at android.app.Activity.startActivity(Activity.java:4522) at android.app.Activity.startActivity(Activity.java:4490) at com.netease.nim.uikit.business.session.activity.P2PMessageActivity.start(P2PMessageActivity.java:52) at com.netease.nim.uikit.impl.NimUIKitImpl.startChatting(NimUIKitImpl.java:352) at com.netease.nim.uikit.api.NimUIKit.startChatting(NimUIKit.java:368) at com.njsoft.jcyy.activity.GoodDetailActivity.UIKitPanel(GoodDetailActivity.java:119) at com.njsoft.jcyy.activity.GoodDetailActivity.onViewClicked(GoodDetailActivity.java:103) at com.njsoft.jcyy.activity.GoodDetailActivity_ViewBinding$2.doClick(GoodDetailActivity_ViewBinding.java:56) at butterknife.internal.DebouncingOnClickListener.onClick(DebouncingOnClickListener.java:22) at android.view.View.performClick(View.java:5637) at android.view.View$PerformClick.run(View.java:22429) 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:6119) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) Caused by: java.io.NotSerializableException: com.njsoft.jcyy.activity.GoodDetailActivity at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1224) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1584) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1549) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1472) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1218) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346) at java.util.ArrayList.writeObject(ArrayList.java:734) at java.lang.reflect.Method.invoke(Native Method) at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:977) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1536) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1472) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1218) at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1584) at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1549) at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1472) at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1218) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346) at android.os.Parcel.writeSerializable(Parcel.java:1522) at android.os.Parcel.writeValue(Parcel.java:1475)  at android.os.Parcel.writeArrayMapInternal(Parcel.java:724)  at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1408)  at android.os.Bundle.writeToParcel(Bundle.java:1157)  at android.os.Parcel.writeBundle(Parcel.java:764)  at android.content.Intent.writeToParcel(Intent.java:8687)  at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:3082)  at android.app.Instrumentation.execStartActivity(Instrumentation.java:1518)  at android.app.Activity.startActivityForResult(Activity.java:4225)  at android.support.v4.app.BaseFragmentActivityApi16.startActivityForResult(BaseFragmentActivityApi16.java:54)  at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:67)  at android.app.Activity.startActivityForResult(Activity.java:4183)  at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:732)  at android.app.Activity.startActivity(Activity.java:4522)  at android.app.Activity.startActivity(Activity.java:4490)  at com.netease.nim.uikit.business.session.activity.P2PMessageActivity.start(P2PMessageActivity.java:52)  at com.netease.nim.uikit.impl.NimUIKitImpl.startChatting(NimUIKitImpl.java:352)  at com.netease.nim.uikit.api.NimUIKit.startChatting(NimUIKit.java:368)  at com.njsoft.jcyy.activity.GoodDetailActivity.UIKitPanel(GoodDetailActivity.java:119)  at com.njsoft.jcyy.activity.GoodDetailActivity.onViewClicked(GoodDetailActivity.java:103)  at com.njsoft.jcyy.activity.GoodDetailActivity_ViewBinding$2.doClick(GoodDetailActivity_ViewBinding.java:56)  at butterknife.internal.DebouncingOnClickListener.onClick(DebouncingOnClickListener.java:22)  at android.view.View.performClick(View.java:5637)  at android.view.View$PerformClick.run(View.java:22429)  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:6119)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

回复

使用道具 举报

0

主题

2

帖子

20

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
20
发表于 2018-6-5 09:44:23 | 显示全部楼层
您好,看您的错误是由于,您包下的这个类没有实现序列化的异常,您需要看下,您onclick之后,是否实现了这个类的序列化。

Caused by: java.io.NotSerializableException: com.njsoft.jcyy.activity.GoodDetailActivity
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表