I'm trying to load an image from the resource in my Android app but I keep getting the "IllegalArgumentException: Expected file scheme in URI" error.
I put my 'missing_album_art.png' file in drawable-hdpi, drawable-ldpi and drawable-mdpi folders in my project and refreshed Eclipse so that it displays they're there.
The line I'm using to create the Uri is:
Uri uri = Uri.parse("android.resource://android.aberplayer/R.drawable.missing_album_art");
The 'android.aberplayer' is the main package of my application and also the one containing the class in which I use the above line.
The error I keep getting is:
03-16 00:16:29.252: E/AndroidRuntime(25598): FATAL EXCEPTION: main
03-16 00:16:29.252: E/AndroidRuntime(25598): java.lang.IllegalArgumentException: Expected file scheme in URI: android.resource://src.android.aberplayer/R.drawable.missing_album_art
03-16 00:16:29.252: E/AndroidRuntime(25598): at java.io.File.checkURI(File.java:245)
03-16 00:16:29.252: E/AndroidRuntime(25598): at java.io.File.<init>(File.java:182)
03-16 00:16:29.252: E/AndroidRuntime(25598): at android.aberplayer.CurrentSongList.getCurrentAlbumArt(CurrentSongList.java:69)
Is there something I don't understand about accessing the image resources in Android applications?