开发者

Android dialog crashes, when I try to change its image

开发者 https://www.devze.com 2023-03-26 09:26 出处:网络
I\'ve made my custom android dialogue, but when I try to dynamically change an imageview inside it, the application crashes.

I've made my custom android dialogue, but when I try to dynamically change an imageview inside it, the application crashes.

    Dialog dialog = n开发者_运维百科ew Dialog(this,R.style.myBackgroundStyle);
    dialog.setContentView(R.layout.dialog);

    dialog.show();

    ImageView ivDialogLetter = (ImageView) findViewById(R.id.ivDialogLetter);
    ivDialogLetter.setImageDrawable(drwLetter); // <- this line kills is.

Any ideas what might be the problem?

Thanks!


Try this

ImageView ivDialogLetter = (ImageView) dialog.findViewById(R.id.ivDialogLetter);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号