java.lang.ClassNotFoundException: Didn't find class "android.os.PersistableBundle" on path: DexPathL
导致问题的原因有很多,所以解决办法不一样。1移除Activity中的这个方法@Overridepublic void onSaveInstanceState(Bundle outState, PersistableBundle outPersistentState) {super.onSaveInstanceState(outState, outPersistentState);}
·
导致问题的原因有很多,所以解决办法不一样。
1移除Activity中的这个方法
@Override
public void onSaveInstanceState(Bundle outState, PersistableBundle outPersistentState) {
super.onSaveInstanceState(outState, outPersistentState);
}
2或者替换1中的代码段
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
}
3我出现的问题原因很奇怪:
问题还原,在fragment中用bundle传值,贴代码如下
xml
<TextView
android:id="@+id/tvEntryRoomBtn"
android:layout_width="@dimen/dimen_0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="center"
android:clickable="true"
android:onClick="entryRoom"
android:text="进入房间"
android:textColor="@color/tv_white"
android:textSize="24px" />
fragment
void entryRoom() {
//进入到群组
if (augur != null) {
roomID1 = augur.getRoomID1();
roomID2 = augur.getRoomID2();
new Thread(new Runnable() {
@Override
public void run() {
try {
EMGroupManager.getInstance().joinGroup(roomID1);//需异步处理
EMGroupManager.getInstance().joinGroup(roomID2);//需异步处理
EMChat.getInstance().setAppInited();
mycontext.log(roomID1 + " 1加入的公开群" + roomID2 + " 2加入的公开群" + "augurId:" + augur.getObjectId());
} catch (EaseMobException e) {
e.printStackTrace();
}
}
}).start();
Intent intent = new Intent(mycontext, ChatContainerActivity.class);
Bundle bundle = new Bundle();
bundle.putSerializable(ConstantInfo.AUGUR_CHATROOM, augur);
intent.putExtra("bundle", bundle);
mycontext.startActivity(intent);
}
}
我的问题出在,我在xml文件中,写了 android:onClick=”entryRoom” 这句代码。
然后我很天真的给fragment中的控件加上了onClick事件,然而这样并不好用。
不建议大家直接在fragment中直接通过xml为控件设置onClick=”” 方法。
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐



所有评论(0)