Im trying to load an image from url to my android ImageView. but it gives no image for my url. but when i call another sample url it loads on the ImageView
My URL which gives empty
https://192.168.100.15/HeyVoteWeb/Home/GetImage/d9cbd32c-47fc-4644-ab97-1f525c96e9ed/100000102
This sample URL works for me
https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png
This is the code i am working on
public class GetImage extends Activity{
ImageView postpic1;
Bitmap b;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.all_posts);
postpic1 = (ImageView) findViewById(R.id.postpic1);
information info = new information();
info.execute("");
}
public class information extends AsyncTask<String, String, String>
{
@Override
protected String doInBackground(String... arg0) {
try
{
URL url = new URL("https://localhost/HeyVoteWeb/Home/GetImage/d9cbd32c-47fc-4644-ab97-1f525c96e9ed/100000102");
InputStream is = new BufferedInputStream(url.openStream());
b = BitmapFactory.decodeStream(is);
} catch(Exception e){}
return null;
}
@Override
protected void onPostExecute(String result) {
postpic1.setImageBitmap(b);
}
}
}