Latimerius, Do you mean something like this? (I ripped this from another site)
Resources res = context.getPackageManager().getResourcesForApplication("com.example.foo") I was doing something very similar already (posted below), though thought it was a bit of a hack. final String packName = "com.jash.cp_source_two"; String mDrawableName = "a1"; try { PackageManager manager = getPackageManager(); Resources resources = manager.getResourcesForApplication(packName); int mDrawableResID = resources.getIdentifier(mDrawableName, "drawable",packName); Drawable myDrawable = resources.getDrawable( mDrawableResID ); if( myDrawable != null ) { image = (ImageView) findViewById(R.id.imageView1); image.setImageDrawable(myDrawable ); } } catch (PackageManager.NameNotFoundException e) { Toast.makeText(getBaseContext(), "error = "+e, Toast.LENGTH_LONG).show(); } Is there any reason to use your method over what I already had? Also, July was a big month and Mark Murphy posts a lot! Do you happen to remember roughly what the topic was to help narrow down the search ;) Thanks a great deal for this. Russ On Wednesday, January 2, 2013 10:42:23 AM UTC, latimerius wrote: > On Wed, Jan 2, 2013 at 2:20 AM, Russell Wheeler <russellpe...@gmail.com> > wrote: > > > > Latimerius, > > > So how do you directly access them from the assets folder? > > > > You have to know the name of the package whose images you want to use but > that shouldn't be a problem in your case if I understand correctly. Then you > just pass it to createPackageContext() which you call on one of your > Activities (I use the "main" one but I guess it probably doesn't matter much > which one you pick) to retrieve a Context of the package containing images. > After that, everything works the same as when working with "this" package's > resources - you call getResources() or getAssets() on the Context etc. > > > > Doing it this way, are the images available to anyone who has root access? > i.e. can they steal your images? > > > > Then can do that anytime anyway. Everybody seems surprised to learn that (I > know I was!) but anybody can access your assets and resources any time they > please with just minor inconvenience, and they DON'T need root for that. > > > > (There was a thread about this on this group last July I think, Mark Murphy > had some insights back then so look it up if you're interested.) > > > > > Why do you use assets? For ease, or for some other reason? I thought it would > be better to have them in the res folders so that the diff screen sizes still > get used, e.g. ldpi/hdpi etc folders? > > > > I use assets because the program I work on is a game, or a toy, which uses > custom rules to adapt to different screen sizes and densities. We started > off using resources but quickly found out that Android's built-in scaling > etc. was just ruining our art and throwing off our screen layout algorithms. > > > > Of course, even if res folders didn't work for us with our special needs, > they can still work splendid for you. In that case, just go for res, I have > no first-hand experience with that but I don't see any reason why it > shouldn't work. -- 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