Solve NotSerializableException
<p>I'm fairly new to Java, and I cannot seem to solve this <code>NotSerializableException</code> that I receive. I'm writing an object to the sdcard of the user and next I need to read it back.</p>

<p>This is my code:</p>

<pre><code>@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!");
}
</code></pre>

<p>I'm using <code>readObjectFromMemory</code> and <code>writeObjectFromMemory</code> from <a href="http://stackoverflow.com/questions/11211262/write-read-any-object-to-from-android-memory">here</a> and this is the error:</p>

<pre><code>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.&lt;init&gt;(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
</code></pre>

<p>I'd like if is it possible to explain as good as possible as I'm fairly new and this might help other people too.</p>
