Just create a custom layout with ImageView and add it to your custom Toast:
Toast toast = new Toast(getApplicationContext());
toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
toast.setDuration(Toast.LENGTH_SHORT);
toast.setView(yourCustomView); // <- you custom View
toast.show();
Look at this: Custom toast in android : a simple example
EDIT:
ok try this (WARNING ugly pseudocode!!):
public void yourMethod(){
new Thread(new Runnable(){
public void run(){
final Bitmap bmap = getBitmapFromURL("your URL");
runOnUiThread(new Runnable() {
public void run() {
ImageView img = new ImageView();
img.setImageBitmap(bmap );
Toast toast = new Toast(getApplicationContext());
toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
toast.setDuration(Toast.LENGTH_SHORT);
toast.setView(img); // <- you custom View
toast.show();
}
});
}
}).start();
}
public Bitmap getBitmapFromURL(String link) {
try {
URL url = new URL(link);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.connect();
InputStream input = connection.getInputStream();
Bitmap bmap = BitmapFactory.decodeStream(input);
return bmap ;
} catch (IOException e) {
e.printStackTrace();
return null;
}
}