I load a class from another installed package.

Class c = classLoader.loadClass(..);
Object o = c.newInstance();
and create a instance using newInstance().

if i use getMethod() and  invoke(),
 i can  invoke that class' method.

but if use MyInterface instance =  (MyInterface)  o;
it failed:  java.lang.ClassCastException: com.mygame.Race

com.mygame.Race is the class i want to load, and Race implements
MyInterface.

at the meantime, Race is chiled of Activity.
however, Activity a = (Activity)o; works fine.

told me why?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to