Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to send a LatLng instance to new intent
    primarykey
    data
    text
    <p>I need to pass an instance of the LatLng class to another intent. How should I do it? Here's the code.</p> <pre><code>LatLng fromPosition = new LatLng(23.4555453556, 11.145315551); LatLng toPosition = new LatLng(12.1115145311, 99.333455333); Intent i= new Intent(Maps.this, Routes.class); startActivity(i); </code></pre> <p>Please help me out here.</p> <p>Route class:</p> <pre><code> public class Routes extends FragmentActivity { GoogleMap mMap; GMapV2Direction md; private String provider; double lati; double longi; String name; Location location; Document doc; PolylineOptions rectLine; Bundle bundle = getIntent().getParcelableExtra("bundle"); LatLng fromPosition = bundle.getParcelable("from_position"); LatLng toPosition = bundle.getParcelable("to_position"); public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.maps2); md = new GMapV2Direction(); mMap = ((SupportMapFragment)getSupportFragmentManager() .findFragmentById(R.id.map)).getMap(); LatLng coordinates = fromPosition; mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(coordinates, 16)); mMap.addMarker(new MarkerOptions().position(fromPosition).title("Start")); mMap.addMarker(new MarkerOptions().position(toPosition).title("End")); new ParseXML().execute(); } private class ParseXML extends AsyncTask&lt;Void, Void, Document&gt; { @Override protected Document doInBackground(Void... params) { doc = md.getDocument(fromPosition, toPosition, GMapV2Direction.MODE_DRIVING); ArrayList&lt;LatLng&gt; directionPoint = md.getDirection(doc); rectLine = new PolylineOptions().width(3).color(Color.RED); for (int i = 0; i &lt; directionPoint.size(); i++) { rectLine.add(directionPoint.get(i)); } return null; } @Override protected void onPostExecute(Document result) { // TODO Auto-generated method stub mMap.addPolyline(rectLine); } } } </code></pre> <p>This is my route class. I don't know the problem. Help me out here. It seems to send the bundle fine but there's an error while receiving it.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload