I want to convert the value from shared preferences to mutable list of LatLng pairs to draw a polylines. I dont know how to convert it. Please help.Here I get the value in shared preferences polyl
as [lat/lng:(10.184133,76.4005395),lat/lng(10.1840907,76.4004505)]etc. How do I convert it to mutable list of LatLng pairs so that I could draw a polyline.
val sharedPr= activity?.getPreferences(Context.MODE_PRIVATE)
val polyl= sharedPr?.getString("polylinep",null)
Toast.makeText(requireContext() ,"$polyl", Toast.LENGTH_SHORT).show()
try {
val polyline10= polyl as MutableList<LatLng>
Toast.makeText(requireContext() ,"ub$polyline10", Toast.LENGTH_SHORT).show()
map.addPolyline(
PolylineOptions().apply {
width(10f)
color(Color.BLUE)
jointType(JointType.ROUND)
startCap(ButtCap())
endCap(ButtCap())
addAll(polyline10)
}
)
} catch (e:java.lang.ClassCastException){
}