The ClassCastException means that the Java Runtime does not like your
request to convert a Serializable into a HashMap. What is less clear
is why: but the J2SE API docs give a pretty good clue when they say:

"Thrown to indicate that the code has attempted to cast an object to a
subclass of which it is not an instance. "
(http://java.sun.com/j2se/1.4.2/docs/api/)

On Nov 13, 1:32 am, Samuh <[email protected]> wrote:
> I have a Hashtable, which, I need to pass to another activity. Since,
> Hashtable is Serializable, I am doing the following:
>
> Hashtable mHashTable = new Hashtable();
> // load values
>
> Intent intent = new Intent(this,SecondActivity.class);
> intent.put("table",mHashTable);
>
> startActivity(intent);
>
> In the Second activity, I try to read the extras in OnCreate(..) as:
>
> Hashtable table = (Hashtable)getIntent().getSerializableExtra
> ("table");
>
> I get ClassCastException at this line in Logcat:
>
> 11-13 14:21:15.939: ERROR/AndroidRuntime(922): Caused by:
> java.lang.ClassCastException: java.util.HashMap
>
> What is that I am missing or doing wrong here?
>
> Please help.
>
> Thanks.

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
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