Android phones and tablets support Bluetooth communications (“BT”).
BT is a very low power, very short range communication technology used for connecting earphone and headphone adapters, wireless microphones, and wireless keyboards and mice to computers and tablets.
App Inventor supports BT links and can be used to transmit data back and forth between two Android devices.
When two devices communicate, one device acts as a “server” and the other as a “client”, although either send and receive data.
I now have basic Bluetooth communication working between two Android phones. As I finalize the Bluetooth sample app, I will post a tutorial here on how to set up Bluetooth and how to write apps that use Bluetooth communication.
Longer term, I intend to connect an App Inventor app to an Arduino microcontroller board using the Bluetooth link. I will post information on that once it is available.
(Due to volunteering every evening with a FIRST Robotics team, and a few extra things going on, my updates are a little less frequent at the moment – sorry!)
When your app needs the user to select an item from a list of choices, use the Spinner control.
Suppose we have a really simple restaurant menu that provides a choice of tacos and drinks. Our customer may select a Chicken, Beef or Vegan taco from an interface that looks like this:
Touching the Chicken Taco item on the screen displays a set of options – select a desired item from the list:
The Designer View
Continue reading Using the Spinner Control for Selecting Items
This post is a major update to a previous post on reading and writing text files using App Inventor. This revision includes information on how to locate the text files you create in your App Inventor apps, plus how to transfer those files from your smart phone or tablet to your computer.
An earlier blog post described how to store data using TinyDB so that an app’s data can persist between uses of the program, or even to share data between screens in a program.
Another way to save data is to write the data to a file on your Android device. App Inventor has introduced a File control that lets us write text data to a file and then read it back, later. As we will see, the File control is not the easiest thing to use but with some work, the control can be used to store data from our program into a file.
Once data is in a file, you could, hypothetically, transfer the file from an Android to device to another computer. Because Android stores the files in a way that they may not be readily accessible – or even visible – we need to use some simple tricks to find the file and transfer the file to a computer.
Update: To learn more about text files and transferring data in the CSV file format, check out Volume 3 of “App Inventor 2 Databases and Files” – thanks!
Continue reading Updated: Writing and Reading Text Files Using App Inventor
How to implement a button that continuously changes color, as demonstrated in this video example:
The Designer View
Create a simple user interface with two buttons – one to start the color change and the other to stop the color changes. In the button properties, set the button shape to “oval”.
Drag a clock component into the Designer – the Clock will appear as a non-visible component at the bottom of the Viewer.
Continue reading Changing an App Inventor button’s color continuously
This tutorial covers the simple changing of the color of a button, while the app is running. You may also set a component’s color by changing the color properties on the Properties list in the Designer.
A second tutorial will show how to implement the continuously changing color demonstrated in the video example. That will be posted next!
The Designer View
To demonstrate the “simple” version, create an app with this user interface:
Each time the button is pressed, the color of the button will change.
Continue reading Changing the color of a button (or other components) in App Inventor
What the App Does
This is the fifth version of 5 app versions that implement a tip calculator – and the final version is pretty cool! This app is useful – I was recently traveling and used it on my smart phone to calculate restaurant tips – I will post a short tutorial on how to install this app on your phone.
- Version 1 introduced the basic app and the use of error checking to handle user data entry mistakes.
- Version 2 introduced the Slider user interface component to select the tip amount. Using the Slider, the user selects a tip from 0% to 30%. Since there is no text entry, it is not possible for an incorrect tip value to be entered.
- Version 3 introduced an improved user interface to eliminate user data entry errors.
- Version 4 introduces “procedures” to clean up the code in preparation for version 5.
- Version 5 revises Version 4 to make the calculation of the tip fully automatic plus fixes some minor oddities.
In Version 5, we eliminate the “Calculate tip and total amount” button by making the calculation automatic. Each time we enter a digit or adjust the slider, the tip is calculated immediately. There is no need to press a button to do the calculation. Just enter a bill amount and optionally adjust the slider to select a tip percentage.
The Tip Calculator User Interface
The new user interface eliminates the Calculate button and adds a single “Clear All” button as a quick way to reset the calculator. This sets the bill amount back to zero and the tip amount to 20%.
Here is a view of the app in operation – the bill amount of 23.45 has been entered on the keypad and the tip amount is 20%. The tip and total bill are shown at the bottom of the screen.
Each time any digit is entered – or the tip is adjusted – the tip and total is automatically calculated.
Continue reading App Inventor Tip Calculator version 5: Fully automated!