Sorry, I missed this mail, glad to hear you got it working. On Fri, Nov 13, 2009 at 11:07 AM, Samuh <[email protected]> wrote: >> The ClassCastException means that the Java Runtime does not like your >> request to convert a Serializable into a HashMap. > > I understand the meaning of ClassCastException; I did skim through the > Javadocs docs before posting here. > The problem is: I am not casting Serializable to HashMap but a > Hashtable. > >> > Hashtable table = (Hashtable)getIntent().getSerializableExtra >> > ("table"); >> > > I put Hashtable in the Intent Extras() so I thought the cast was safe. > > Thanks. > > On Nov 13, 3:38 pm, Indicator Veritatis <[email protected]> wrote: >> 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.- Hide quoted text - >> >> - Show quoted text - > > -- > 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
-- 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

