Note that there are some explanatory texts on larger screens.

plurals
  1. POClass not found when unmarshalling when passing Parcelable through Messenger to remote service
    primarykey
    data
    text
    <p>I have a Parcelable object which I use to pass it from Activity to remote service. When I pass it using <strong>AIDL</strong> interface, everything sounds fine. </p> <p>Recently, I try to pass it through <strong>Messenger</strong> from Activity.</p> <pre><code>// TEST TEST TEST! StockInfo stockInfo0 = new StockInfo(Code.newInstance("code0"), Symbol.newInstance("symbol0")); StockInfo stockInfo1 = new StockInfo(Code.newInstance("code1"), Symbol.newInstance("symbol1")); StockInfo stockInfo2 = new StockInfo(Code.newInstance("code2"), Symbol.newInstance("symbol2")); List&lt;StockInfo&gt; stockInfos = new ArrayList&lt;StockInfo&gt;(); stockInfos.add(stockInfo0); stockInfos.add(stockInfo1); stockInfos.add(stockInfo2); StockInfosEx stockInfosEx = new StockInfosEx(stockInfos, "abc"); msg.obj = stockInfosEx; try { mService.send(msg); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } </code></pre> <p>I'm getting the following exception in remote service.</p> <blockquote> <p>02-21 22:55:16.546: E/Parcel(8365): Class not found when unmarshalling: com.example.testonmessenger.StockInfosEx, e: java.lang.ClassNotFoundException: com.example.testonmessenger.StockInfosEx</p> </blockquote> <p>I was wondering, what can get wrong in between? Here is my Parcelable object.</p> <pre><code>public class StockInfosEx implements Parcelable { public final List&lt;StockInfo&gt; stockInfos; public final String searchedString; public StockInfosEx(List&lt;StockInfo&gt; stockInfos, String searchedString) { this.stockInfos = stockInfos; this.searchedString = searchedString; } //////////////////////////////////////////////////////////////////////////// // Handling Parcelable nicely. public static final Parcelable.Creator&lt;StockInfosEx&gt; CREATOR = new Parcelable.Creator&lt;StockInfosEx&gt;() { public StockInfosEx createFromParcel(Parcel in) { return new StockInfosEx(in); } public StockInfosEx[] newArray(int size) { return new StockInfosEx[size]; } }; private StockInfosEx(Parcel in) { stockInfos = new ArrayList&lt;StockInfo&gt;(); in.readTypedList(stockInfos, StockInfo.CREATOR); searchedString = in.readString(); } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel parcel, int flags) { parcel.writeTypedList(stockInfos); parcel.writeString(searchedString); } // Handling Parcelable nicely. //////////////////////////////////////////////////////////////////////////// } </code></pre> <p>To get complete source code, kindly download from <a href="https://www.dropbox.com/s/n69yuhddpb8vedz/testonmessenger.zip" rel="noreferrer">https://www.dropbox.com/s/n69yuhddpb8vedz/testonmessenger.zip</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload