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 <[email protected]
> 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
[email protected]

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.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" 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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to