android - How to parcel a short[] array? -


how can parcel following parameter?

short[] types; 

since i've tried this:

// write parcel dest.writevalue(types);  // read parcel ??? 

how can achieve this?

for short array can't write , read directly parcel. http://developer.android.com/reference/android/os/parcel.html

you may try this.

// write dest.writeint(types.length); (int = 0; < types.length; i++) {     dest.writeint((int) types[i]); }  // read len = parcel.readint(); short[] types = new short[len]; (int = 0; < len; i++) {     types[i] = (short) parcel.readint(); } 

Comments