0

I have few images in assets folder i want to retrieve the path of the each image file and copy them into array and finally set to image view with some condition. i have used the below code.But it did not workout for me. may i know where i am going wrong.

final Uri ASSETS_URI = Uri.parse("file:///android_asset");
final String[] IMAGE_IDS =new String[] {ASSETS_URI+"/"+"one.png",ASSETS_URI+"/"+"two.png",ASSETS_URI+"/"+"three.png"};

iv=(ImageView)findViewById(R.id.iv);
if(i>=0 & i< IMAGE_IDS.length-1)
   i=i+1;
else if(i==IMAGE_IDS.length-1)
   i=0;

iv.setImageURI(Uri.parse(IMAGE_IDS[i]));
user1903270
  • 77
  • 3
  • 14

1 Answers1

0

try to change :

    final Uri ASSETS_URI = Uri.parse("file:///android_asset");

to this:

   final String ASSETS_URI = "file:///android_asset";

I think the problem is that you are concatenating and Uri with a String. If you declare ASSETS_URI as String then everything is String and later parsed to Uri.

Mikel
  • 411
  • 4
  • 8
  • i changed it to string but i am still getting the same error like: resolveUri failed on bad bitmap uri: file:///android_asset/one.png – user1903270 Aug 01 '13 at 05:38