1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| private void fillData() {
Cursor c = mDbHelper.fetchAllMagasin(laville);
startManagingCursor(c);
if(c!=null && c.moveToFirst()){
String leplan=c.getString(c.getColumnIndex("plan"));
ImageView imgView =(ImageView)findViewById(R.id.imgplan);
try{
URL ulrn = new URL("http://www.monsitei/images/"+leplan+".png");
HttpURLConnection con = (HttpURLConnection)ulrn.openConnection();
InputStream is = con.getInputStream();
BufferedInputStream bis = new BufferedInputStream(is, 8192);
Bitmap bm = BitmapFactory.decodeStream(bis);
bis.close();
is.close();
if (null != bm)
imgView.setImageBitmap(bm);
else
System.out.println("The Bitmap is NULL");
}catch(Exception e){}{
System.out.println("Exc="+e);
}
}
} |