カスタムのアラート ダイアログ ボックスを作成せずに、デフォルトのアラート ダイアログ ボックスに表示されるアイコンを動的に設定する方法はありますか? たとえば、次の alertDialog のメソッド setIcon() で、内部にパスが格納された uri 変数を使用して提供する画像を表示したいと思います。
private void showProductInfo(){
MyProduct myProduct= (MyProduct) myProductGoldenRetriever();
final AlertDialog alertDialog = new AlertDialog.Builder(this).create();
alertDialog.setTitle("Product Information");
alertDialog.setMessage(myProduct.getMyProductInfo());
alertDialog.setButton("Back", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
showPrompt();
}
});
alertDialog.setIcon(R.drawable.default_img);//<--Here Need to Provide a different image each time
alertDialog.show();
}//endOfShowProductInfo
これは何とか可能ですか、それとも適切な .xml レイアウト ファイルを使用してカスタム alertDialog を作成する必要がありますか?