Choosing a resource from SDCard instead of Drawable

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Choosing a resource from SDCard instead of Drawable

Postby Profete162 » Sat Dec 26, 2009 1:23 pm

Hi there,

( sorry if my english is not so good, i am a belgian user)

I am currently developing an app that allow the user to choose a custom icon. ( i create a Home shortcut to my app with a ressource that user can select).

All is working fine with :

Code: Select all
        i.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,Intent.ShortcutIconResource.fromContext(getBaseContext(), myIcon)); // mycon is for example R.drawable.icon

But now I would like to allow the user to put his own icon for example in /SDCARD/myappname/icon.png.

As i cannot give an ID to a png on the SDCARD, i really don't know how to do that....

Have you any idea?

Thank a lot.

Experienced Developer
Experienced Developer
Posts: 67
Joined: Fri Nov 27, 2009 6:07 pm


Postby sing1e » Sun Dec 27, 2009 3:03 pm


I think you can use this class BitmapDrawable.
There is a constructor method named BitmapDrawable (InputStream is).
You can use this method!
Posts: 9
Joined: Sat Dec 12, 2009 10:55 am


Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 3 guests