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.setAction("com.android.launcher.action.INSTALL_SHORTCUT");   
       
        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.


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

Top

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

Hi,

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

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: Exabot [Bot] and 5 guests