I need to pass an instance of the LatLng class to another intent. How should I do it? Here\'s the code.
LatLng fromPosition = new LatLng(23.4555453556, 11.14
use the putParcelable method to attached LatLng Object to a Bundle:
Bundle args = new Bundle();
args.putParcelable("from_position", fromPosition);
args.putParcelable("to_position", toPosition);
Now attach it to your intent:
i.putExtra("bundle", args);
To get it in your new activity:
Bundle bundle = getIntent().getParcelableExtra("bundle");
LatLng fromPosition = bundle.getParcelable("from_position");
LatLng toPosition = bundle.getParcelable("to_position");