Programming Part 2: Pinning a Location

This part of the app is actually easier to program than Part 1 because fewer elements are involved. Let’s start by creating the core feature: pinning a location. When the Pin_Location_Button is clicked, we want to do two things: copy the Current Location text to the Pinned Location display and save it in TinyDB.

Drag a TinyDB component into the Designer, if you have not already done so.

Assemble the click event handler for the Pin_Location_Button (see Figure 10.25).

Image

Figure 10.25 When the Pin_Location_Button is clicked, store the current location data to the TinyDB and copy it to the Pinned Location display. ...

Get Learning MIT App Inventor: A Hands-On Guide to Building Your Own Android Apps now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.