Learn to Program with App Inventor by Lyra Logan

Learn to Program with App Inventor by Lyra Logan

Author:Lyra Logan
Language: eng
Format: epub, azw3
Publisher: No Starch Press
Published: 2020-02-09T16:00:00+00:00


Then, to change the Map’s height to 50 percent so it takes up half the vertical screen, click the text box under Height; when the dialog opens, input 50 in the text box next to the word percent and click OK. Next, set its Width to Fill parent, click the checkbox under ShowUser so an icon representing the user will show on the Map and track the user’s location, and change the Map zoom level from the default 13 to 10 by inputting 10 in the ZoomLevel text box.

Now drag a Marker from the Maps drawer onto the Map. Adjust the Marker in the Properties pane by clicking the text box under Latitude and entering the latitude for the user’s home address, then clicking the text box under Longitude and entering its longitude.

Next, to let users select a destination and a phone number to send it to, under Map1, drag two ListPickers from the User Interface drawer to the Viewer. Rename ListPicker1 to NumberPicker and ListPicker2 to PlacePicker. In the Properties pane for both, change the background color to yellow by clicking Default under BackgroundColor and then Yellow when the color list dialog opens. Then make the text bold by clicking the checkbox under FontBold, and make the text larger by inputting 25 in the FontSize text box. Replace the default Text for ListPicker1 by entering Select a Number in the Text text box for NumberPicker and the default Text for ListPicker2 by entering Select a Place in the Text text box for PlacePicker.

Change the Width for both ListPickers to Fill parent, and change the color of the items in the selection drop-downs to yellow by clicking Default under ItemTextColor and then Yellow when the color list dialog opens. Then, in the Properties pane for PlacePicker, click the checkbox under Visible to remove the check mark and keep PlacePicker from showing when the app first opens. We’ll program it later to appear after the user picks a phone number.

Finally, drag in the non-visible components: the LocationSensor component from the Sensors drawer and the Texting component from the Social drawer. In the Properties pane, change the LocationSensor’s TimeInterval from the default 60,000 milliseconds to 1,000 by choosing 1000 in the drop-down box below TimeInterval. This means that the app’s LocationSensor will report location changes each second if location data is available and the location has changed since the last interval. We’re making this change so that later you can program your app to text updated location information as frequently as every second after new data becomes available.

Now that we’ve added LocationSensor1, click the Map in the Components pane and, in its Properties pane, choose its associated LocationSensor by clicking None under LocationSensor, selecting LocationSensor1 in the dialog that opens, and clicking OK.

Screen1 should look like Figure 5-1.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.