private void changePicture(int stageIndex){
try{
iv=(ImageView) findViewById(R.id.imageView2);
Picture picture=new Picture();
String v =picture.getPicFileName();
InputStream ims = getAssets().open(v);
Drawable d = Drawable.createFromStream(ims, null);
iv.setImageDrawable(d);
}catch(IOException ex){
return;
}
}
Run Code Online (Sandbox Code Playgroud)
我想从/asset文件夹中加载图像列表,所以我编写了此函数,但是它不起作用。有人能帮我吗?