This doesn't seem to be working properly.

What I am trying to do is pass a class through onActivityResult()
using a Bundle I have put in the associated Intent.

To this end, I have made my class implement Parcelable with all the
associated methods and
 CREATOR.

The parcel is written when, eventually, the following method is called


public void writeToParcel(Parcel dest, int flags) {
                Log.d(TAG,"writing to parcel...");

                dest.writeInt(value);
                dest.writeStringArray(options);
                dest.writeIntArray(conversions);
                dest.writeInt(system);
        }

...and read back out later with....

private void readFromParcel(Parcel in) {
                Log.d(TAG,"reading from parcel...");
                in.setDataPosition(0);
                value = in.readInt();
                options = in.createStringArray();
                conversions = in.createIntArray();
                system = (short) in.readInt();
        }

My problem is that when creating the "options" String Array, I get the
error below. When I remove the lines that write and create the String
array  everything works fine.

As you can see, I'm being told that an array size is too large. The
array has THREE elements.

Has anyone had experience with this? Is there something I'm
overlooking?


02-18 17:30:50.880: ERROR/AndroidRuntime(10814): Uncaught handler:
thread main exiting due to uncaught exception

02-18 17:30:50.900: ERROR/AndroidRuntime(10814):
java.lang.InternalError: array size too large<<<<<<<<
HERE<<<<<<<<<<<<<<<<<<

02-18 17:30:50.900: ERROR/AndroidRuntime(10814):     at
android.os.Parcel.createStringArray(Parcel.java:813)
02-18 17:30:50.900: ERROR/AndroidRuntime(10814):     at
com.ozdroid.model.measurement.Mass.readFromParcel(Mass.java:202)
02-18 17:30:50.900: ERROR/AndroidRuntime(10814):     at
com.ozdroid.model.measurement.Mass.<init>(Mass.java:89)
02-18 17:30:50.900: ERROR/AndroidRuntime(10814):     at
com.ozdroid.model.measurement.Mass.<init>(Mass.java:88)
02-18 17:30:50.900: ERROR/AndroidRuntime(10814):     at
com.ozdroid.model.measurement.Mass$1.createFromParcel(Mass.java:29)
02-18 17:30:50.900: ERROR/AndroidRuntime(10814):     at
com.ozdroid.model.measurement.Mass$1.createFromParcel(Mass.java:1)
02-18 17:30:50.900: ERROR/AndroidRuntime(10814):     at
android.os.Parcel.readParcelable(Parcel.java:1903)
02-18 17:30:50.900: ERROR/AndroidRuntime(10814):     at
android.os.Parcel.readValue(Parcel.java:1771)
02-18 17:30:50.900: ERROR/AndroidRuntime(10814):     at
android.os.Parcel.readMapInternal(Parcel.java:2005)
02-18 17:30:50.900: ERROR/AndroidRuntime(10814):     at
android.os.Parcel.readBundleUnpacked(Parcel.java:1405)
02-18 17:30:50.900: ERROR/AndroidRuntime(10814):     at
android.os.Bundle.unparcel(Bundle.java:159)
02-18 17:30:50.900: ERROR/AndroidRuntime(10814):     at
android.os.Bundle.getString(Bundle.java:966)
02-18 17:30:50.900: ERROR/AndroidRuntime(10814):     at
com.ozdroid.load.LoadView.onActivityResult(LoadView.java:294)
02-18 17:30:50.900: ERROR/AndroidRuntime(10814):     at
android.app.Activity.dispatchActivityResult(Activity.java:3614)
02-18 17:30:50.900: ERROR/AndroidRuntime(10814):     at
android.app.ActivityThread.deliverResults(ActivityThread.java:3001)
02-18 17:30:50.900: ERROR/AndroidRuntime(10814):     at
android.app.ActivityThread.handleSendResult(ActivityThread.java:3047)
02-18 17:30:50.900: ERROR/AndroidRuntime(10814):     at
android.app.ActivityThread.access$2300(ActivityThread.java:112)
02-18 17:30:50.900: ERROR/AndroidRuntime(10814):     at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1721)
02-18 17:30:50.900: ERROR/AndroidRuntime(10814):     at
android.os.Handler.dispatchMessage(Handler.java:99)
02-18 17:30:50.900: ERROR/AndroidRuntime(10814):     at
android.os.Looper.loop(Looper.java:123)
02-18 17:30:50.900: ERROR/AndroidRuntime(10814):     at
android.app.ActivityThread.main(ActivityThread.java:3948)
02-18 17:30:50.900: ERROR/AndroidRuntime(10814):     at
java.lang.reflect.Method.invokeNative(Native Method)
02-18 17:30:50.900: ERROR/AndroidRuntime(10814):     at
java.lang.reflect.Method.invoke(Method.java:521)
02-18 17:30:50.900: ERROR/AndroidRuntime(10814):     at
com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:782)
02-18 17:30:50.900: ERROR/AndroidRuntime(10814):     at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
02-18 17:30:50.900: ERROR/AndroidRuntime(10814):     at
dalvik.system.NativeStart.main(Native Method)





-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to