안드로이드 개발 질문/답변
(글 수 45,052)
이미지를 저장해서 목록에서 보여주려고 하는데요.. 이상하게 계속 특정 이미지만 못불러오네요.. LoadImage 이 함수상에서 계속 비트맵이 널을 뿜는걸로 봐서 뭔가 문제가 있긴 한거 같은데 ㅠㅠ
다 안되면 모르겠는데 특정 이미지만 계속 못뿌리네요 ㅠㅠ
혹시 해결방법 아시는분 도움좀 부탁드립니다 ㅠㅠ안되는 이미지 경로들..
http://dreamdeals.kr/mall/updir/products/4519ac00.jpg
http://coupang.com/./files/attach/images/49/634/219/img02.jpg
http://p-cup.kr/mall/updir/products/ea200090.jpg
잘되는 애들
http://daejeon.couponmemory.com/cms/data/product/26b8b3c091/1.jpg
http://kupon.co.kr/kupon_img/kupon35_small.jpg
ㅠㅠ 능력자님들 도움좀 ㅠㅠ
public InputStream getInputStream(String $imagePath) {
// TODO Auto-generated method stub
System.setProperty("sun.net.client.defaultConnectTimeout", "5000");
System.setProperty("sun.net.client.defaultReadTimeout", "6000");
InputStream stream = null ;
Log.d("RND_TEST","getInputStream - getUrl "+$imagePath);
for(int i=0;i<5;i++){
try {
URL url = new URL( $imagePath ) ;
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection() ;
urlConnection.setReadTimeout(6000);
urlConnection.setConnectTimeout(5000);
urlConnection.connect() ;
if( urlConnection.getResponseCode() == HttpURLConnection.HTTP_OK ) {
Log.d("RND_TEST","getInputStream - OK "+urlConnection.getContentType());
return stream = urlConnection.getInputStream() ;
}
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Log.d("RND_TEST","getInputStream - False");
}
return null ;
}
public Bitmap LoadImage( String $imagePath ) {
for(int i=0;i<5;i++){
InputStream inputStream = getInputStream( $imagePath ) ;
Bitmap bm = BitmapFactory.decodeStream( inputStream ) ;
if(bm == null){
Log.d("RND_TEST","imgErr = Null!! ");
continue;
}
Log.d("RND_TEST","ImageSize = "+bm.getWidth());
return bm;
}
return null;
}




대부분 jsp나 servlet으로 파일 위치를 가리고 화면단에서 이미지를 동적으로 가져오게 하고 있죠.