thanks for the response.

(btw it used to work the other way round. did something change in r2 or r3?)

i don't want to do it this way, trust me. i'm having to do this 
because i can't get a FileDescriptor to a file in /assets in my apk - 
i get a "this file is zipped" error or somesuch. so i get an 
InputStream from assetManager.open(path), cache it in /sdcard, then 
get a FileDescriptor to the file and return that (from 
ContentProvider.getFile()).

is there a better way round this than getting the resources for a 
"foreign" activity like i'm doing?

thanks,
j



>Those are different component names.  Unless "MainBarf" is truly a 
>class at the top-level name-space, you probably meant to use the 
>same name as in the first one.
>
>Also you should very very extremely ever write out a component name 
>like the second one, where you explicitly specify the package and 
>class names.  If nothing else, this is very fragile, since you are 
>putting implementation details into your code.  If you are trying to 
>make an Intent to reference something in another package, it is best 
>to use this as a generic Intent that the package manager will find 
>an implementation for; the only reason to hard-code a component name 
>is if you have things separated in two different packages, but don't 
>want to allow any others to provide their own functionality for them.
>
>And if this is a component in your own class, just use new 
>ComponentInfo(getContext, MainBarf.class).
>
>On Thu, Aug 6, 2009 at 4:52 PM, Jason Proctor 
><<mailto:jason.android.li...@gmail.com>jason.android.li...@gmail.com> 
>wrote:
>
>
>replying to myself here.
>
>if i make the ComponentInfo with getContext() and the full name of
>the class, then the PackageManager does not barf getting resources
>for it. however, if i use discrete package name & component name,
>eenoworkee.
>
>example
>
>(works)
>info = new ComponentInfo (getContext (), "com.barfer.product.MainBarf");
>pm.getResourcesForActivity (info);
>
>(fails)
>info = new ComponentInfo ("com.barfer.product", "MainBarf");
>pm.getResourcesForActivity (info);
>
>should the second one work? it worked until recently.
>
>thanks.
>j
>
>
>
>>my application caches static resources in its /assets directory and
>>implements a content provider to provide them to a WebView on
>>request. i kinda have to drive around the houses a bit because it
>>seems i can't get a linear file descriptor on an asset, i get "this
>>resource is zipped" or somesuch, don't know why that's a problem.
>>the content provider just caches the asset in /sdcard and then
>>returns a file descriptor off that.
>>
>>this has been mostly working fine, but i've started seeing errors
>>from the PackageManager. nothing's changed on my end, the assets are
>>still there, etc.
>>
>>the actual error i'm getting is --
>>
>>android.content.pm.PackageManager$NameNotFoundException:
>>ComponentInfo{package/activity}
>>
>>(where "package" is the name of the package, etc)
>>
>>can i get anything wrong with this stuff? caching javascript and css
>>stuff in the apk has been a big performance win.
>>
>>thanks
>>--
>>jason.software.particle
>
>
>--
>jason.software.particle
>
>
>
>
>--
>Dianne Hackborn
>Android framework engineer
><mailto:hack...@android.com>hack...@android.com
>
>Note: please don't send private questions to me, as I don't have 
>time to provide private support, and so won't reply to such e-mails. 
> All such questions should be posted on public forums, where I and 
>others can see and answer them.
>
>
>

-- 
jason.software.particle

--~--~---------~--~----~------------~-------~--~----~
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