我对Java相当陌生,我似乎无法解决NotSerializableException
我收到的这个问题。我正在向用户的 SD 卡写入一个对象,接下来我需要将其读回。
这是我的代码:
@Override
protected void createAndAttachView(int id, FrameLayout frame) {
//Read the panel from the memory
PanelWrapper pnl = (PanelWrapper) readObjectFromMemory(B4AHelper.getDirDefaultExternal(), "layout.frame");
//Add the view
frame.addView(pnl.getObject());
//Broadcast an intent to the user.
intent = new IntentWrapper();
intent.Initialize("createAndAttachView", "");
intent.PutExtra("id", id);
intent.PutExtra("message", "View Attached");
sendBroadcast(intent.getObject());
//Log - debugging
Log.i("B4A", "View attached!");
}
我正在使用readObjectFromMemory
和writeObjectFromMemory
从这里,这是错误:
Error Message: anywheresoftware.b4a.BALayout
Error Message: Read an exception; java.io.NotSerializableException: anywheresoftware.b4a.BALayout
Caused by: java.lang.NullPointerException
at com.rootsoft.standout.MostBasicWindow.createAndAttachView(MostBasicWindow.java:53)
at com.rootsoft.standout.StandOutWindow$Window.<init>(StandOutWindow.java:2213)
at com.rootsoft.standout.StandOutWindow.show(StandOutWindow.java:1416)
at com.rootsoft.standout.StandOutWindow.onStartCommand(StandOutWindow.java:716)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2359)
... 10 more
我想是否有可能解释得尽可能好,因为我还很新,这也可能对其他人有所帮助。