Getting path of local image instead of URL Android

1.1k views Asked by At

I am working with gif images at the moment and have followed the answer from the question here

From this I have the following line of code:

    GifWebView view = new GifWebView(this, "http://cdn.lifebuzz.com/images/17487/lifebuzz-35df9a5ee351ae72711e5a293658e319-limit_2000.gif");

Now, I want to download this image, save it locally in the "drawable" folder or "assets" folder and then access it from there.

I have tried downloading the image into the "drawable" folder and trying :

    GifWebView view = new GifWebView(this, "@drawable/myimg.gif");

I have also tried this:

    int imageResource = R.drawable.myimg;

    Drawable image = getResources().getDrawable(imageResource);

    String imageUri = "drawable://" + R.drawable.myimg;

    GifWebView view = new GifWebView(this, imageUri);

Still no luck.

I've tried accessing it from the assets folder but this seemed even more complicated.

I just would like to save it locally and access it locally, I don't really care where it is stored.

Thanks for any help.

EDIT

public GifWebView(Context context, String path) {

    super(context);        
    loadUrl(path);
}
0

There are 0 answers