开发者

How to access layout parameters for Custom Alert Dialog...?

开发者 https://www.devze.com 2023-04-12 12:16 出处:网络
I am getting null pointer exception, due to failed to recognize layout parameter in the custom alert dialog.

I am getting null pointer exception,

due to failed to recognize layout parameter in the custom alert dialog.

So, If any one know this please help me...?

Thanks in advance...!

builder = new AlertDialog.Builder(this);
        builder.setView(getLayoutInflater().inflate(R.layout.custom_dialog, null));
        //AlertDialog dialog = new AlertDialog.Builder(this).create();
        //dialog.setContentView(R.layout.custom_dialog);
        dialog = builder.create();
        customDialogList = (ListView) dialog.findViewById(R.id.custom_list);
        customDialogLis开发者_开发问答t.setAdapter(customDialogAdapter); // here null pointer exception    
        dialog.setCancelable(true);
        dialog.show();


builder = new AlertDialog.Builder(this);
        view customView = getLayoutInflater().inflate(R.layout.custom_dialog, null);
        builder.setView(customView);
        //AlertDialog dialog = new AlertDialog.Builder(this).create();
        //dialog.setContentView(R.layout.custom_dialog);
        dialog = builder.create();
        customDialogList = (ListView) customView.findViewById(R.id.custom_list);
        customDialogList.setAdapter(customDialogAdapter);   
        dialog.setCancelable(true);
        dialog.show();

try this.

0

精彩评论

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

关注公众号