I am trying to transfer data from one page to another, but some problem below is the code. I am trying to pass the value of a variable using a bundle from the first activity to the second, but something is wrong, please tell me what is going wrong.
below is the first activity: -
package route.planning; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.Toast; public class login extends Activity { Context mCtx; final static int START =0; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mCtx = this; Button btn = (Button)findViewById(R.id.btn); btn.setOnClickListener(new OnClickListener(){
Below is the part of the second action in which I try to get the value from above
import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import java.util.ArrayList; import java.util.List; import org.ci.geo.route.Road; import org.ci.geo.route.RoadProvider; import route.planning.R; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Point; import android.os.Bundle; import android.os.Handler; import android.widget.LinearLayout; import android.widget.TextView; import com.google.android.maps.GeoPoint; import com.google.android.maps.MapActivity; import com.google.android.maps.MapController; import com.google.android.maps.MapView; import com.google.android.maps.Overlay; public class MapRouteActivity extends MapActivity { LinearLayout linearLayout; MapView mapView; private Road mRoad; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.routeplanning); mapView = (MapView) findViewById(R.id.mapview); mapView.setBuiltInZoomControls(true); Bundle extras = this.getIntent().getExtras(); final String fLat=extras.getString("fromLat"); final String fLong=extras.getString("fromLong"); final String tLat=extras.getString("toLat"); final String tLong=extras.getString("toLong"); new Thread() { @Override public void run() { double fromLat=Double.parseDouble(fLat); double fromLon=Double.parseDouble(fLong); double toLat=Double.parseDouble(tLat); double toLon=Double.parseDouble(tLong);
android
Prachur
source share