How to access a widget from within a layout with Alert Builder?
<p>How does one access a particular widget from within a custom layout while using Alert Builder? As you can see below, I'm setting the alert to a widget that is created in the code, but I'd MUCH rather use predefined layout.</p>

<p>Current code:</p>

<pre><code>    private AlertDialog numberDialog(String title, final int dialogID){
            AlertDialog.Builder alert = new AlertDialog.Builder(this);                 
            alert.setTitle(title);  

            final NumberPicker np = new NumberPicker(this);
            alert.setView(np);
            alert.setPositiveButton(R.string.done, new DialogInterface.OnClickListener() {  
                    public void onClick(DialogInterface dialog, int whichButton) {
                            int newNumber = np.getCurrent();
                            calculatorVO.setWaiste(newNumber);
                            PFACalculator.this.updateList();
                            return;                  
                    }  
            });  

            alert.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                            return;   
                    }
            });

            AlertDialog ad = alert.create();
            return ad;
    }
</code></pre>

<p>Psuedo-code for something I'd like:</p>

<pre><code>    private AlertDialog numberDialog(String title, final int dialogID){
            AlertDialog.Builder alert = new AlertDialog.Builder(this);                 
            alert.setTitle(title);  
            alert.setView(R.layout.numberDialog);
            alert.setPositiveButton(R.string.done, new DialogInterface.OnClickListener() {  
                    public void onClick(DialogInterface dialog, int whichButton) {
                            NumberPicker np = (NumberPicker)findViewById(R.id.numpicker);
                            int newNumber = np.getCurrent();
                            calculatorVO.setWaiste(newNumber);
                            PFACalculator.this.updateList();
                            return;                  
                    }  
            });  

            alert.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                            return;   
                    }
            });

            AlertDialog ad = alert.create();
            return ad;
    }
</code></pre>

<p>However, whenever I try to do it the second way I get a null pointer exception. Can anyone help?</p>
