정수 배열에서 R.drawable.img를 가져갈 때처럼 정수 배열에서 이미지를 가져 오려고합니다.서버에서 이미지를 가져 와서 안드로이드에서 int 배열로 설정합니다.
예컨대 : 당신은 서버에서 이미지를 촬영 할 때 int[] images = {R.drawable.a , R.drawable.b , R.drawable.c , R.drawable.d};
는이 같은 동일합니다. 배열의
선언 : 서버에서
String images[] = new String[1000];
가져 오기 이미지와는 안될 배열을 int로 설정합니다.
public void onResponse(String response) {
Log.d("TAG", "Message Response: " + response.toString());
hideDialog();
try {
JSONObject jsonObj = new JSONObject(response);
boolean error = false;
p = jsonObj.getJSONArray("response");
for (int i = 0 ; i < p.length(); i++) {
JSONObject c = p.getJSONObject(i);
String profilepicture = c.getString("profile_picture");
byte[] decodedString = Base64.decode(profilepicture, Base64.DEFAULT);
Bitmap decodedByte = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length);
Drawable drawable = new BitmapDrawable(getResources(),decodedByte);
images[i] = drawable;
}
그리기 가능 값 [email protected]
이다. 그러나 그것은 정수 배열을 설정하지 않습니다.
최종 목표가 ImageView에 드로어 블을 표시하는 것이라면 Piccaso 또는 Android-Universal-Image-Loader를 사용하십시오. url 배열을 만들고 url을이 라이브러리에 전달하면이 라이브러리는 이미지 다운로드 및 표시 부분을 처리합니다. 또한 이미지 캐싱을 제공합니다. –