Android Question how to access the java URI.BUILDER with B4A?

DavideV

Active Member
Licensed User
Longtime User
Hello people,
i would like to access the Java uri.builder scheme like this below:

B4X:
Uri.Builder directionsBuilder = new Uri.Builder()
        .scheme("https")
        .authority("www.google.com")
        .appendPath("maps")
        .appendPath("dir")
        .appendPath("")
        .appendQueryParameter("api", "1")
        .appendQueryParameter("destination", lat + "," + lon);

Is there a way to do this with B4A (maybe using javaobject)?

Thanks in advance
Davide
 

DonManfred

Expert
Licensed User
Longtime User
You just can create the url by yourself. Using okhttp and parametrized parameters you don´t need to do anything special...

A sample url is like


B4X:
    Dim job As HttpJob
    job.Initialize("direction",Me)
    job.Download2("https://maps.googleapis.com/maps/api/directions/json",Array As String("origin", "New York, NY", "destination", "Boston, MA","waypoints","optimize:true|Providence, RI|Hartford, CT","key","yourkey"))

You also can use Javaobject or Inline JAva.
 
Last edited:
Upvote 0
Top