Identifying the cause of serious errors in App Inventor apps

Some times App Inventor 2 apps stop working (well mine sometimes do this, may be your’s don’t!)

Besides looking carefully at your blocks code, there are some additional steps that may be helpful in identifying the cause of the problem.

1. Check your blocks code very carefully to see if you can spot an error in your program.

2. Add a status message area in the user interface (using the Designer) and then in your blocks code, add blocks to assign status texts to this message area. Your status message could include a message indicating what section of your code is running, or to display the values of variables in your program.

3. Add a special “Error handler” to catch and display information when the program encounters a serious problem. The following section is adapted from my tutorial on basic Bluetooth communications.

Error  Handling

For most of our App Inventor apps, we ignore potential errors – if errors occur, the app stops running and Android displays error messages.

Our app can intercept the error condition by adding an error event handler to the main screen, Screen1. In the Blocks editor, select the Screen1 component and then select the When Screen1.ErrorOccurred event. Drag this to the Blocks editor and then add the following code.

The ErrorOccurred event has four parameter values (local variables) that contain information about the error. This error handler displays the error values on your device screen, rather than immediately shutting down the app.

BTServerErrorHandler

 

To use this code, add a text label to your user interface – in the example above, the label has been renamed to lblStatus.

There is no guarantee that these error values will identify the specific problem but they may give an indication as to where the problem is occurring in your program!

App Inventor adds new source code “Gallery”

App Inventor has added a new source code “Gallery” for sharing source code with others.

From the My Projects list of your projects, at the far right, find a new feature to “Publish to Gallery”. To use, create a graphic image to illustrate your app – such as a screenshot. You will later upload this to the Gallery along with a description of what your source code does.

Add a link to a web page (if any) that contains a tutorial or video about your app or source code.

PublishGallery

To find other code already added to the Gallery, click on the Gallery menu item near the top/upper right of the AI menu.

Have fun!

(And yes, I am back from recent travels – still recovering – fell a sleep after lunch today! I hope to start adding some of the source code from this blog to the Gallery soon!)

How to take a Screenshot

(This works on my Android devices) To take a snapshot of what is on your Android device screen, press the device power button and the volume control DOWN button simultaneously. This captures a screen snapshot and saves it to your Photo Gallery.  Email that photo to yourself or do what ever you do to transfer files from your device to your computer, for subsequent processing/viewing, editing, re-sizing and what have you.

Can you build an App Inventor app for the Google Play store?

I wrote this in response to a question on this web site’s Facebook page.

Someone asked if there was perhaps a paid version of App Inventor required for building apps that go in the Google Play store? No, there is no paid version.

You do not need a paid version of App Inventor; just use the Build .apk option to create an Android package file that can be installed on an Android device.

You can then submit your apps to the Google Play store. You will need to pay a US $25, one time only, to open a developer account. Thereafter, you may upload as many apps as you want to the Play store.

You’ll also need to create some screen snapshots and upload those as part of your app description in the Play store. There is much additional good information here – http://beta.appinventor.mit.edu/learn/reference/other/appstoplay.html

How to create App Inventor apps for the Google Play store is on my list of future tutorials. Unfortunately, I do not have time right at the moment to put that together – but eventually I will have something and describe the process in step-by-step detail!

Multiline text input in App Inventor

The App Inventor TextBox control supports both single line and multi-line input; the TextBox control default to single line mode – and you may not have realized it can support multiple line text input too!

In single line input, text is entered using the on screen keyboard, followed by the Enter key (or you can use an external Bluetooth keyboard). Once the enter key is pressed, the on screen keyboard goes away.

Multi-line mode is enabled by checking the Multiline checkbox item in the control properties. However, the Enter key is used to enter multiple text lines – that means you need to complete the multiline text entry by adding another control, such as a Done button.

The multi-line control is easy to use – and needs just a single line of blocks code to implement! Describing the operation of the control takes more time!

App View

The multiline TextBox looks like a single line text box, as shown here, after entering “first line” into the TextBox control as the app is running.

Screenshot_2015-04-08-18-03-40

To enter a second (or third…) line, tap the green/blue Enter button at the lower right of the onscreen keyboard. Here is the result after typing three lines of text:

Screenshot_2015-04-08-18-03-57

Continue reading

Android App Inventor app creation is world-wide!

This webblog web server tracks the country of web site visitors and draws this map showing which countries visited this web site in one day this past week.

AppInventorPevestReadership

Since this web blog was started, readers have visited from 158 countries around the world! Thank you for stopping by!

The entire world is interested in creating Android apps using App Inventor!

Please Share on Social Media

Please click on the buttons below this post to share with your friends on Facebook or other social media.

If you are not already following this blog, click on the following links to like on Facebook, add to your Google+ circles or follow on Twitter or in your RSS news reader. Thank you for visiting!

What is inside a .aia project file?

As you may know, you can save your App Inventor project to your local computer using the Projects | Export selected project (.aia) to my computer menu option:

ExportSelected

Use this feature to save a backup copy on your local computer or to share your code with others (email or transfer the file using DropBox – or similar – or merely copy to a USB thumb drive).

What is inside the .aia file?

Surprisingly, the .aia file is just a regular .zip file. You can verify by saving a copy to your local disk drive, and then rename the file to have a .zip file extension instead of .aia. Then use Windows Explorer, StuffIt Expander or other utility to open and decompress the .zip file.

PLEASE NOTE – DO NOT MODIFY THE CONTENT OF THESE FILES.  THIS INFORMATION IS NOT SOMETHING YOU NEED TO KNOW TO WRITE APP INVENTOR APPS AND IS PROVIDED “AS IS” “FOR YOUR INFORMATION” ONLY.

Continue reading