With Ken Wolf helps..
public class DownloadImageTask extends AsyncTask<String, Void, Bitmap> {
ImageView bmImage;
private Context mcontec;
public DownloadImageTask(ImageView bmImage, Context mContextr) {
this.bmImage = bmImage;
mcontec=mContextr;
}
protected Bitmap doInBackground(String... urls) {
String urldisplay = urls[0];
Bitmap mIcon11 = null;
try {
InputStream in = new java.net.URL(urldisplay).openStream();
mIcon11 = BitmapFactory.decodeStream(in);
} catch (Exception e) {
Log.e("Error", e.getMessage());
e.printStackTrace();
}
return mIcon11;
}
protected void onPostExecute(Bitmap result) {
dialog(result, mcontec);
}
public void dialog(Bitmap resim, final Context ctx){
final Dialog dialog = new Dialog(ctx, R.style.CustomDialogTheme);
dialog.setContentView(R.layout.perdereklam);
ImageView reklam = (ImageView) dialog.findViewById(R.id.reklampng);
reklam.setImageBitmap(resim);
reklam.setOnTouchListener(new OnTouchListener() {
// fill your stuff...
}
dialog.show();
}
calling from any class:
public static void showRateDialog(final Context mContextr) {
final Dialog dialog = new Dialog(mContextr, R.style.CustomDialogTheme);
ImageView reklam = (ImageView) dialog.findViewById(R.id.reklampng);
final DownloadImageTask dt = new DownloadImageTask(reklam, mContextr);
dt.execute("your url");
}