Transforming string to list

Hi,
I’m having a string with the following structure:
((41.34826 21.55133) (41.34846 21.55111) (41.34864 21.55089))
I want to use this string to draw a polyline but points argument only accepts list.
blocks

I tried to transform this string into a list using:

But it is not working. The error I’m getting is:
java.lang.String cannot be cast to com.google.appinventor.components.runtime.util.YailList

Any help please…
Thx

This format
Your pairs should be like this :
[
{ lat: 37.772, lng: -122.214 },
{ lat: 21.291, lng: -157.821 },
{ lat: -18.142, lng: 178.431 },
{ lat: -27.467, lng: 153.027 },
]

Thx, I didn’t know that Get Points from JSON block exist. But i still have problem. I receive error: java.util.ArrayList cannot be cast to java.lang.Number whenever i run this code:


My JSON String data is:
[{ lat: 37.772, lng: -122.214 },{ lat: 21.291, lng: -157.821 },{ lat: -18.142, lng: 178.431 },{ lat: -27.467, lng: 153.027 }]

I can’t find out what i’m doing wrong… :frowning:

Cek this

Or

No extension is required to do this.

Didn’t help either.
But i found the solution:
The JSON format for using the Get Points from JSON component is the following
[[41.34826,21.55133],[41.34846,21.55111],[41.34864,21.55089]]

In this case the polyline is drawing on the screen

And here are the blocks:

Polylines and Makers

Makers taking from the database and polylines made with 2 points after the user makes 2 long clicks on the map


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.