开发者

How to access layout parameters for 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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜