Problem while switching between activities in Android
<p>0
down vote
I having the same problem, I got a runtime error when I press the button that should change the activity</p>

<pre><code>package com.example.LocationTracker;

import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button;

public class LocationTracker extends Activity{ /** Called when the activity is first created. */

Button btn_Tracker;
Button btn_Display_Map;
Context context;


@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    context = getApplicationContext();
    btn_Tracker = (Button)findViewById(R.id.btn_Tracker);


    btn_Tracker.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
        //setContentView(R.layout.trackeractivity);
        Intent myIntent1 = new Intent(view.getContext(),   TrackerActivity.class);
        context.startActivity(myIntent1);
        }});
}

class TrackerActivity extends Activity {

//Your member variable declaration here

// Called when the activity is first created.
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.trackeractivity);
}
}
</code></pre>

<p>I added everything right in the maniefest file</p>

<pre><code>&lt;activity android:name=".TrackerActivity" android:label="@string/app_name"/&gt;

&lt;activity android:name=".DisplayMapActivity" android:label="@string/app_name"/&gt;

&lt;/application&gt;
</code></pre>

<p>please help me.</p>

<p>Thanks</p>
