RuntimeException (ComponentInfo) Nullpointerexception
<p>I am trying to figure out where my problem is.
I know that the problem is the NullPointerException. But I don´t know
why.</p>

<p>I only have a Button that starts an activity.</p>

<p>This is the code part the causes the problem. If I remove the startactivity it works fine.
And the exception only happens after the Intent.Method1 ended successful.</p>

<pre><code>methodtest(parm1);

try{
        startActivity( IntentFactory.Method1(parm1, parm2) );
    } catch(ActivityNotFoundException e){
        showToast(getText(R.string.error1));
    }
</code></pre>

<p>This is my logcat of the exception.</p>

<blockquote>
  <p>07-06 08:09:03.176: E/AndroidRuntime(2385): java.lang.RuntimeException: Unable to start activity ComponentInfo{net.apptest.app1/net.apptest.app1.activities.TabbedNavigationActivity}: java.lang.RuntimeException: Unable to start activity ComponentInfo{net.apptest.app1/net.apptest.app1.activities.ExtrasActivity}: java.lang.NullPointerException<br>
  07-06 08:09:03.176: E/AndroidRuntime(2385): Caused by: java.lang.RuntimeException: Unable to start activity ComponentInfo{net.apptest.app1/net.apptest.app1.activities.ExtrasActivity}: java.lang.NullPointerException<br>
  07-06 08:09:03.176: E/AndroidRuntime(2385):     at net.apptest.app1.abstivities.AbstractHttpActivity.registerOnClickListener(AbstractHttpActivity.java:262)<br>
  07-06 08:09:03.176: E/AndroidRuntime(2385):     at net.apptest.app1.activities.MainActivity.onCreate(MainActivity.java:309)<br>
  07-06 08:09:03.176: E/AndroidRuntime(2385):     at net.apptest.app1.activities.ExtrasActivity.onCreate(ExtrasActivity.java:18)<br>
  07-06 08:17:38.779: E/AndroidRuntime(2699): java.lang.RuntimeException: Unable to start activity ComponentInfo{net.apptest.app1/net.apptest.app1.activities.TabbedNavigationActivity}: java.lang.RuntimeException: Unable to start activity ComponentInfo{net.apptest.app1/net.apptest.app1.activities.ExtrasActivity}: java.lang.NullPointerException<br>
  07-06 08:17:38.779: E/AndroidRuntime(2699): Caused by: java.lang.RuntimeException: Unable to start activity ComponentInfo{net.apptest.app1/net.apptest.app1.activities.ExtrasActivity}: java.lang.NullPointerException<br>
  07-06 08:17:38.779: E/AndroidRuntime(2699):     at net.apptest.app1.abstivities.AbstractHttpActivity.registerOnClickListener(AbstractHttpActivity.java:262)<br>
  07-06 08:17:38.779: E/AndroidRuntime(2699):     at net.apptest.app1.activities.MainActivity.onCreate(MainActivity.java:309)<br>
  07-06 08:17:38.779: E/AndroidRuntime(2699):     at net.apptest.app1.activities.ExtrasActivity.onCreate(ExtrasActivity.java:18)<br></p>
</blockquote>

<p>Line 262 in AbstractHTTPActivity:</p>

<pre><code> * @param v
     *            The view an OnClickListener should be registered for
     * @param id
     *            The id used to identify the item clicked (&lt;code&gt;ITEM_*&lt;/code&gt;
     *            statics)
     */
    protected void registerOnClickListener(View v, final int id) {
        v.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                onItemClicked(id);
            }
        });
    }
</code></pre>

<p>Line 309 in MainActivity:</p>

<blockquote>
  <p>mDB2S = (Button) findViewById(R.id.ButtonDB2S);<br>
  registerOnClickListener(mDB2S, ITEM_DB2S);</p>
</blockquote>

<p>Line 18 in ExtrasActivity:</p>

<blockquote>
  <p>super.onCreate(savedInstanceState);</p>
</blockquote>

<p>And my layout.xml</p>

<blockquote>
  <p></p>
</blockquote>

<pre><code>            &lt;Button
                android:id="@+id/ButtonDB2S"
                android:layout_width="fill_parent"
                android:layout_height="65dp"
                android:layout_gravity="center_vertical"
                android:layout_weight="1"
                android:drawableLeft="@drawable/ic_menu_help"
                android:text="@string/db2" /&gt;
</code></pre>

<p>Here is my IntentFactory.Method1. It only starts a video and it normally works without problems. I am using this method on an second place where it works without exception.
And Methodtest is another method which runs fine only the startActivity line is causing this problem.</p>

<pre><code>    public static Intent Method1 (String parm1, String parm2) {
        Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(parm1), "video/*");     
        return intent;
    }
</code></pre>

<p>EDIT: 
I have debbuged a little more and found out where the NullPointerException happens. On the MainActivity I am loading the button on startup to mDB2 and it works fine. After I quit the videoplayer which was started by IntentFactory.Method1 the View is reloaded which means that the MainActivity is started again. But now mDB2 cant find the button and is NULL. But on first run it work without any problem</p>
