开发者

Android dialog crashes, when I try to change its image

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜