Intent intent = new Intent();
Bundle bundle = new Bundle();
bundle.putSerializable("service", (Serializable) mChatService);
intent.putExtras(bundle);提示bundle.putSerializable这句出错,classCastException,mChatService是BluetoothChatService类型的,这个问题怎么解决?
Bundle bundle = new Bundle();
bundle.putSerializable("service", (Serializable) mChatService);
intent.putExtras(bundle);提示bundle.putSerializable这句出错,classCastException,mChatService是BluetoothChatService类型的,这个问题怎么解决?
解决方案 »
- 如何设置gridview的行数
- android在有些手机上竖着拍照横着放如何解决
- 为什么我新建一个xml文件,android系统总是报错
- 真机如何访问PC服务器?
- pc与android之间利用socket通信,如何实现端口转发??
- android 伪装定位是怎么做的
- 手机联机进行游戏,不联网的话要怎么办呢
- android 2.1 怎么实现listview自动滚动
- Eclipse 中项目属性不可以设置成islibrary
- AndroidStudio3.1构建工程出错Failed to execute aapt
- 请问Android支持几种中文字体类型?opentype支持吗?
- 刚买的三星GT-S5660android机器用来开发遇到的问题,求大虾给出解决方法
是源码里的例子,源码实现的是蓝牙聊天,我已经把BluetoothChatService这个类implements Serializable了,还是同样的错误,我在BluetoothChat里加的代码:
case MESSAGE_READ:
byte[] readBuf = (byte[]) msg.obj;
// construct a string from the valid bytes in the buffer
String readMessage = new String(readBuf, 0, msg.arg1);
mConversationArrayAdapter.add(mConnectedDeviceName+": " + readMessage);
//如果双方都准备好,这开始对战
if(readMessage.equals("ready") && isReady == true){
Intent intent = new Intent();
Bundle bundle = new Bundle();
bundle.putSerializable("service", (Serializable) mChatService);
intent.putExtras(bundle);
intent.setClass(BluetoothChat.this,LLKanActivity.class);
BluetoothChat.this.startActivity(intent);
}
break;