0

I read from XML.

<movie>
    <id>1</id>
    <title>Fast</title>
    <background>assets://icon/photography1</background>
</movie>

Now I have gotten Class Movie.

How can I add assets://icon/photography1 in my ImageView?

livibetter
  • 19,832
  • 3
  • 42
  • 42
CoolEgos
  • 47
  • 1
  • 10

1 Answers1

0

You can add an image from assests to an image view programmatically through java code in android. Code for that is given below:

ImageView image = (ImageView) findViewById(R.id.imageView1);
AssetManager assetManager = getAssets();
        InputStream istr;
        try { 
            istr = assetManager.open("vishal.jpg");
            Bitmap bitmap = BitmapFactory.decodeStream(istr);
            image.setImageBitmap(bitmap);
            istr.close();
        } catch (IOException e) {
            e.printStackTrace();
        } 
frogEye
  • 364
  • 3
  • 14