This is my first android app and i'm new in programming, i want to show imageView inside AlertDialog, actually i searched for that but i just found that i must specify the image in the xml layout file!
like that one, i just want to get that image from the java code not from xml because that image generated by the user
That's part from my code:
EditText et = (EditText) findViewById(R.id.editText);
final Bitmap bm = QRCode.from(et.getText().toString()).bitmap();
ImageView iv = (ImageView) findViewById(R.id.imagev);
iv.setImageBitmap(bm);
Button btn = (Button) findViewById(R.id.button);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder b = new AlertDialog.Builder(MainActivity.this);
b.setMessage("Want to save it?");
b.setView(iv);
b.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(getApplicationContext(),
"Tapped on YES!", Toast.LENGTH_SHORT)
.show();
}
});
b.setNegativeButton("Delete", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(getApplicationContext(),
"Tapped on DELETE!", Toast.LENGTH_SHORT)
.show();
}
});
AlertDialog ad = b.create();
ad.show();
}
});
I want to display that "iv" in the dialog, thanks! :)