There are none code at SVN?
I want to reference how to use DexFile correctly...



On 4月21日, 下午6时31分, tu <[EMAIL PROTECTED]> wrote:
> I have a solution based on android.dalvik.DexFile. see my 
> projecthttp://code.google.com/p/rcpandroid/
>
> 2008/4/21, frankl <[EMAIL PROTECTED]>:
>
>
>
>
>
> > Hi chris.p,
>
> > Have you resolved the issue of classloader.getResource? I met the same
> > problem. Please let me know if any updates. that will be highly
> > appreciated.
>
> > Thanks
> > Frank
>
> > On Apr 13, 10:23 pm, "chris.p" <[EMAIL PROTECTED]> wrote:
> > > Hello everyone,
>
> > > I've already managed to load a single class from anothers application
> > > context:
> > > --- code ---
> > > Context foreignContext = context.createPackageContext(packageName,
> > > Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY);
> > > Class<?> c =
> > > foreignContext.getClassLoader().loadClass(qualifiedClassName);
> > > //Do things with c
> > > --- code ---
>
> > > What I would like to do now, is to load all the classes contained in a
> > > certain package
> > > --- code ---
> > > ClassLoader cld = foreignContext.getClassLoader();
> > > String packagePath = "name.to.a.package".replace('.', '/');
> > > URL resource = cld.getResource(packagePath);
> > > File packageDirectory = new
> > > File(URLDecoder.decode(resource.getPath(),"UTF-8"));
> > > //iterate over the contents of the packageDirectory
> > > --- code ---
>
> > > The above code works perfect in Java SE 1.5 (For testing in standard
> > > Java I use the Thread.currentThread().getContextClassLoader() instead
> > > of Androids-Context ClassLoader)
> > > But Android always gives me an exception because resource (URL) is
> > > null.
> > > I also tried providing the package-path differently, with e.g.
> > > the .apk-path as prefix, but that doesn't work either.
> > > From the doc of Classloader in Android, I've seen that the default
> > > behaviour of getResource() is to return null.
> > > This is something the Java SE doesn't state.
> > > Does this mean I can't use Classloader.getResource() in Android?
>
> > > What else could I do to get all classes of a package in Android? -
> > > Load the dex-File?
> > > Any suggestion is greatly appreciated! - Thanks chris- 隐藏被引用文字 -
>
> - 显示引用的文字 -
--~--~---------~--~----~------------~-------~--~----~
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
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to