With your filepath code, I'm not sure if it's even possible. I think res/raw are within the apk, whereas it looks like you are trying to access something off the file system. Plus, when you have "/" as the first part of your path, it's going to look in the root of the file system. If you were saving your images using something like Context.openFileOutput, then your file will be in /data/data/ my.apps.namespace/files/myfilename.myextension. I recall some discussion saying you shouldn't rely on files being stored there though. It might change in the future.
On Apr 13, 3:30 pm, Pzikit Bloo <[EMAIL PROTECTED]> wrote: > I can't store ids in the database, the information comes from > external, anyway getIdentifier is perfect, but now I've the curiosity > to know how I can refer to a file in terms of filepath :) > > On Apr 13, 11:59 pm, "Dan U." <[EMAIL PROTECTED]> wrote: > > > Well, if the file is in res/drawable, why not just use the id to load > > it (store the id in your db instead of filename)? I think there's also > > a getIdentifier in the Resources class that might be of help. > > > On Apr 13, 2:38 pm, Pzikit Bloo <[EMAIL PROTECTED]> wrote: > > > > Thank you guys! > > > > I've tried with both methods! getIdentifier() works good, but I don't > > > find how to express filepath in BitmapDrawable! > > > > BitmapDrawable bd = new BitmapDrawable(filepath + filename + ".png"); > > > image.setImageDrawable(bd); > > > > I've tried with: > > > filepath="/res/drawable/" > > > filepath="/drawable/" > > > filepath="/src/res/drawable/" > > > > But no one works! > > > > On Apr 13, 8:28 pm, "Dan U." <[EMAIL PROTECTED]> wrote: > > > > > I think you could use a BitmapDrawable. There apparently is a > > > > constructor that takes either a filename string or an InputStream. You > > > > could probably use > > > > either:http://code.google.com/android/reference/android/graphics/drawable/Bi...) > > > > > On Apr 13, 11:14 am, Pzikit Bloo <[EMAIL PROTECTED]> wrote: > > > > > > Hi all, > > > > > I'm trying to set an ImageView depending on an input, like a db field, > > > > > so if that is x, image to display will be x.png, and so on.. > > > > > > But how to do this without use R.drawable syntax? > > > > > > Thanks, > > > > > Pzikit Bloo --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---

