我需要将图片网址转为Drawable
,以便我可以在int
数组中使用它。
我想提出d0
,d1
,d3
等,而不是R.drawable.sample_0
,R.drawable.sample_1
等。
我不明白为什么R.drawable.photos
被int
检测为Drawable
而我的Drawable
不是?{/ p>
如何将int
转为public void callEditActivity(){
Intent myIntent = new Intent(context, BirdsGalleryActivity.class);
img0 = myIntent.getExtras().getString("IMG0");
img1 = myIntent.getExtras().getString("IMG1");
img2 = myIntent.getExtras().getString("IMG2");
img3 = myIntent.getExtras().getString("IMG3");
img4 = myIntent.getExtras().getString("IMG4");
}
URL url0 = new URL(img0);
URL url1 = new URL(img1);
URL url2 = new URL(img2);
URL url3 = new URL(img3);
URL url4 = new URL(img4);
Bitmap bmp0 = BitmapFactory.decodeStream(url0.openConnection().getInputStream());
Bitmap bmp1 = BitmapFactory.decodeStream(url1.openConnection().getInputStream());
Bitmap bmp2 = BitmapFactory.decodeStream(url2.openConnection().getInputStream());
Bitmap bmp3 = BitmapFactory.decodeStream(url3.openConnection().getInputStream());
Bitmap bmp4 = BitmapFactory.decodeStream(url4.openConnection().getInputStream());
Drawable d0 = new BitmapDrawable(bmp0);
Drawable d1 = new BitmapDrawable(bmp1);
Drawable d2 = new BitmapDrawable(bmp2);
Drawable d3 = new BitmapDrawable(bmp3);
Drawable d4 = new BitmapDrawable(bmp4);
private int[] GalImages = new int[] {
R.drawable.sample_0,
R.drawable.sample_1,
R.drawable.sample_2,
};
?
<th:block th:switch="${item}">
<input th:case="1" />
<span th:case="*" />
</div>