Skip to first unread message

Bradley Clemons

unread,
Dec 16, 2015, 10:04:30 AM12/16/15
to MIT App Inventor Forum
my name is bradley i am building an app for my farmers market business
as i got to 5 different markets each week i wanted a screen in my app that shows each market i got to its time day and location as well as a get direction button that opens google maps to give directions to exact coordinates to the farmers market
ive tested out the first part of have 4 seperate lists that each have the day of the week name of the market its location name and time to change corresponding labels when u press a previous or next button
however when i tried to add the functionality for using google maps i got this error message on my phone

bad arguments to select list item 
the operation select list item can not accept the arguments [4]3]

the numbers depend on which set of lists i have selected ive also attached a pic of the code (most of what could fit on the screen)

if you could help me i would appreciate it a lot



SteveJG

unread,
Dec 16, 2015, 11:15:35 AM12/16/15
to MIT App Inventor Forum
Many things with Google Maps are tricky.  Here is lots of information about using Google Static maps and Google Maps  with App Inventor  https://appinventorforfun.wordpress.com/tag/mapping/

Directions require you either use the Google Map API to get a list of directions or using something like  the advice provided here 

AI2 Maps 103…the Google Navigation Tutorial for AI2

These links might help you design perhaps a simpler system.  Some of the suggestions use a ListView or a ListPicker to insert the required coordinates into ActivityStarter code to display a regular Google Map that shows the location and destination on a map   .  Simplified


Show a map for a location

If you know a latitude and a longitude, you can use the VIEW action to show a map of the area:

Action: android.intent.action.VIEW

DataUri: geo:37.8,-122.23?z=10

The DataURI here specifies the latitude and longitude and also a zoom value of 10 (z=10).  Zoom value is optional and ranges from 1 (the entire Earth) to 23.

If you know a zip code of a location, you can set the activity starter properties as follows:

Action: android.intent.action.VIEW

DataUri: geo:0,0?q=94043

If you have a street address, you can use a DataUri that encodes the address with a scheme called URL encoding :

Action: android.intent.action.VIEW

DataUri: geo:0,0?q=77+Massachusetts+Avenue%2C+Cambridge%2C+MA

Generally in URL encoding you have to replace spaces (with  %20 or plus sign ) and punctuation marks, such as comma ( %2C ) and period ( %2E ).


So either check your blocks or use one of the alternative methods and try some blocks again.


Regards,
Steve                                   

Taifun

unread,
Dec 16, 2015, 11:18:00 AM12/16/15
to MIT App Inventor Forum
coordinates is a list, isn't it?
so why do you assign an index later?
probably it helps to rename coordinates to listCoordinates to avoid confusion....
Taifun


Reply all
Reply to author
Forward
0 new messages