android - Get resource ID from URI or Bitmap -
android - Get resource ID from URI or Bitmap -
is there anyway can find resource id bitmap, uri, file path or file name of image? these images written app. there chance can find resource id?
basically, have gif images stored in sd card (which created app). want load images viewer. that, using gif film view library. in file, setmovieresource()
expecting int (resource id). have other info bitmap, absolute path.
resource ids automatically generated android files within resource folder (/res
) only. out of folder, there no such thing called "resource id".
some android components (such view
s) do have id , can set manually. however, manually-set id not listed within r.java
, collection of resource ids generated android.
but in case, generated images don't have id, it's impossible doesn't exist beforehand.
regarding library, there function set image source without resource id:
public void setmovie(movie movie) { this.mmovie = movie; requestlayout(); }
now, looking @ movie
class included in android sdk, there other functions decode source: decodebytearray()
, decodefile()
. decodebytearray()
accepts byte array, , decodefile()
accepts file path, can used if have total path file.
while bitmap
can converted byte array, i'm not sure whether bitmap
supports multiple layers/animation of gif image, i'll avoid first approach. instead, can seek this:
gifmovieview gifmovieview = ... ; // reference view string filepath = ... ; // total file path gif image film mymovie = movie.decodefile(pathname); gifmovieview.setmovie(mymovie);
(the above code not tested yet)
android uri android-resources android-file android-bitmap
Comments
Post a Comment