why do I keep getting null exceptions at setOnClickListener
<p>Why do I kee[ getting null errors at setOnClickListener?<br>
R.layout.dataentry is the ContentView.  It has the addRecord (a button) and it loads and displays fine.
It looks as though R.id.addRecord gets an ID when I look in the debugger).
I'm sure it has something to do with the ContentView not being loaded correctly resulting in a null pointer exception when I try to add the listenter, but I've tried preloading it several ways (here, earlier) and I can't figure out how to do it.  I guess I'd prefer to have all my views cached so that I can add listeners early.  Can someone help?</p>

<p>Thanks.</p>

<pre><code>      exercise = (RadioGroup)this.findViewById(R.id.exerciseType);
         addRecord = (Button)this.findViewById(R.id.addRecord);
         amount = (TextView)this.findViewById(R.id.amount);
         datePerformed = (DatePicker)this.findViewById(R.id.datePerfomed);

public void loadAddEntry() {
            setContentView(R.layout.dataentry);
            addRecord.setOnClickListener(
                 new View.OnClickListener(){
                     public void onClick(View view) {
                         addRecordClicked();
                    }

                    ;});

            }
</code></pre>
