Error android- java Null Pointer Exception
<p>I am getting this error when i am inflating another activity on button click of first activity.I am also Passing the data between the activities.when the data is not being passed then it works fine and am able to view the second activity.the data i am passing is the content of text box from the first activity of integer type.Kindly lemme know where am i going wrong.</p>

<p>code for Activity1.class</p>

<pre><code>public void onClick(View v)

    {

        try
        {
    Log.i("MyActivity", "Entered OnClick()");
    //Toast.makeText(getBaseContext(), "Entered", Toast.LENGTH_SHORT).show();
    int value;
    value=Integer.parseInt(range.getText().toString());
    Bundle bundle= new Bundle();
    bundle.putInt("param1",value);
//  Toast.makeText(getBaseContext(), "Wait", Toast.LENGTH_SHORT).show();
    Intent myIntent = new Intent(v.getContext(), RoutePath.class);
    myIntent.putExtras(bundle);
     startActivity(myIntent);
        }
         catch(Exception e)
            {e.printStackTrace();}
    }
</code></pre>

<p>and Activity2.class</p>

<pre><code>public class RoutePath extends MapActivity {

GeoPoint gp1;

GeoPoint gp2;

GeoPoint srcGeoPoint;

GeoPoint destGeoPoint;

double distance;

int value=0;

public void onCreate(Bundle savedInstanceState)

{   



    super.onCreate(savedInstanceState);

    Bundle bundle = getIntent().getExtras();

    value = bundle.getInt("param1",0);

    setContentView(R.layout.main);

    MapView mapView = (MapView) findViewById(R.id.myMapView1);

    mapView.setBuiltInZoomControls(true);

//and then the other code.......

}
</code></pre>

<p>and the stack trace</p>

<pre><code>03-21 15:44:39.276: WARN/System.err(3337): java.lang.NullPointerException
03-21 15:44:39.286: WARN/System.err(3337):     at com.nautilus.RoutePath.Welcome.onClick(Welcome.java:50)
03-21 15:44:39.306: WARN/System.err(3337):     at android.view.View.performClick(View.java:2364)
03-21 15:44:39.331: WARN/System.err(3337):     at android.view.View.onTouchEvent(View.java:4179)
03-21 15:44:39.335: WARN/System.err(3337):     at android.widget.TextView.onTouchEvent(TextView.java:6540)
03-21 15:44:39.348: WARN/System.err(3337):     at android.view.View.dispatchTouchEvent(View.java:3709)
03-21 15:44:39.355: WARN/System.err(3337):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
03-21 15:44:39.355: WARN/System.err(3337):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
03-21 15:44:39.385: WARN/System.err(3337):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
03-21 15:44:39.385: WARN/System.err(3337):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
03-21 15:44:39.385: WARN/System.err(3337):     at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659)
03-21 15:44:39.385: WARN/System.err(3337):     at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107)
03-21 15:44:39.385: WARN/System.err(3337):     at android.app.Activity.dispatchTouchEvent(Activity.java:2061)
03-21 15:44:39.385: WARN/System.err(3337):     at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643)
03-21 15:44:39.385: WARN/System.err(3337):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1691)
03-21 15:44:39.385: WARN/System.err(3337):     at android.os.Handler.dispatchMessage(Handler.java:99)
03-21 15:44:39.385: WARN/System.err(3337):     at android.os.Looper.loop(Looper.java:123)
03-21 15:44:39.385: WARN/System.err(3337):     at android.app.ActivityThread.main(ActivityThread.java:4363)
03-21 15:44:39.385: WARN/System.err(3337):     at java.lang.reflect.Method.invokeNative(Native Method)
03-21 15:44:39.396: WARN/System.err(3337):     at java.lang.reflect.Method.invoke(Method.java:521)
</code></pre>
