Can App Inventor have a button or control that rotates on screen?

A reader asked: Is there is a way to have a control, such as a button, rotate on the screen?

With a simple trick, the answer is Yes!

The trick is to use ImageSprites that are made to look like buttons. Then, instead of .Click event handler, as used on a Button, we use one of the “touch” events defined for the ImageSprite class. To rotate the sprite, change the sprite’s Heading property. Easy!

If you would like to learn more about ImageSprites, please read my online tutorial “Using ImageSprites for animated App Inventor Graphics”.

I’ve also written an inexpensive 227 page e-book all about graphics, animation and charts available from many online e-book outlets. You may find that text helpful to you as well.

Tutorial Video

The tutorial is shown here as a video – or page down for a written version of the tutorial.

User View

Watch this video to see what a rotating button looks like:

Designer View

Creating the user interface is the same as creating other App Inventor user interfaces – except we use a graphical drawing area called the Canvas and add an ImageSprite to the Canvas.

Continue reading

Interesting questions :)

I am back after having been traveling for over 2 weeks (and some travel before that too); during most of that time, I had no Internet or cell phone access.

While I was away, readers sent me questions about how to do various things in App Inventor and I will start working on creating tutorials to answer their questions. I think others will find their questions and possible solutions to solve the problems of interest!

Another reader indicates their’s been a change to the Google Fusion tables API and I will try to look into that and see what’s up.

Google introduces Blockly 1.0 for Android, iOS and web

If you have used MIT App Inventor (and of course you have!), you can quickly adapt to using Blockly for programming.  Blockly is basically a “Drag and Drop” code editor (like in App Inventor), providing a visual programming system. It uses the same ideas as MIT App Inventor.

To see it in operation, visit MIT’s Scratch project to create a simple program.

Google has released code libraries that, when combined with other tools, enable use of Blockly to create code for the web, for iOS and Android. For iOS you also need XCode and for Android you need Android Studio. Blockly is not a programming language itself; it outputs code in JavaScript, Python, Lua and other formats.

Source: Google Developer’s Blog

WATCH THIS VIDEO!

(FYI I am half way through my period of traveling too much and not getting much programming done!)

Brief update

I’ve been busy with other projects, traveling for work, and other tasks, that have cut into my App Inventor posts. Sorry about that!

One task I have been busy with is a project from AV8 Designer LLC to create an aircraft wing tip protection system. The system places proximity sensors on the tips of aircraft wings to detect – and help prevent – collisions with obstacles during aircraft ground movement operations. Aircraft are pushed and pulled around on the ground during all times of the day and night, and during all types of weather. They are frequently squeezed into aircraft hangers and parked extremely close to other aircraft. Unfortunately, this leads to occasional wing tip collisions that are expensive to repair.

The wing tip sensors provide audio and visual alerts of potential collisions and status (with audio and visual display) on Android tablets or smart phones carried by ground crew. The Android app is simple to use but incorporates complex programming to wirelessly communicate with all wing tip sensors. The app and the wireless communication links were implemented using App Inventor, rather than the Android Java SDK.

We took a risk in choosing to use App Inventor. While preliminary experiments were done to verify the concept, we did not know if we could develop the full application in App Inventor. Well, we took the risk and everything worked out great. Using App Inventor we were able to quickly develop – and demonstrate – the user interface and functionality. In doing this project, we proved App Inventor is capable of creating powerful and complex industrial applications. App Inventor can do much more than only educational and gaming applications!

Appy Builder – an alternative to MIT App Inventor, with more features

AppyBuilder is a commercial version of MIT App Inventor that, for a monthly subscription fee, provides access to many additional components and features. Some of these features include monetization services that work with advertising networks to display ads with your apps, plus unique features like SQL Lite and the Android Material Design user interface.  You can also add in-app purchases.

There is also a free version that operates similar to MIT App Inventor. You can set up your free account at the Appy Builder web site or sign up for a subscription account with added features.

AppyBuilder is based on MIT App Inventor – if you know how to use App Inventor, you’ll find AppyBuilder very easy to use. The company behind AppBuilder also does custom app development and mobile web site development.

Click on their “Tell me more” button, and then page down to see the description of features and services, and subscription options.

I’ve played a bit with the “free” version but I could see buying a monthly subscription to access several of their enhanced features. Their lead architect also has a blog including this tutorial on how to use their components to access the web, camera and upload photos to a server using App Builder.

—-

Since I moved the web site from my own server over to the WordPress platform, you will often see posts authored by “Coldstreams”, or sometimes “AppinventorPlus”, rather than my name, EdwardM, that appeared on the old web site. I have 4 separate accounts on WordPress and set them up so that my Coldstreams account can update any of the blogs, including this one. Most of my posts will likely appear with the “Coldstreams” name, but it is still just me 🙂 … EdwardM

How to empty the App Inventor “Backpack”

You know about the App Inventor Backpack?

You can drag blocks into the “Backpack” icon at upper right of the MIT App Inventor Blocks editor. Once in the backpack, you can later drag items out of the backpack  providing a nice way to move blocks around or between apps.

Until recently, the backpack was automatically emptied when you exited App Inventor. But … that has changed recently!

A couple of months ago the Backpack behavior was changed so Backpack content is  persistent. That means the backpack retains a copy of your blocks even when you exit App Inventor.

This makes it easier to move favorite code blocks between apps or apps you download from the MIT Gallery.

To empty the backpack, you need to right-click (Ctrl-click on a Mac) somewhere in the whitespace (background) and then select Empty the Backpack from the pop up menu.

Capture

QuickSort routine for your App Inventor Apps!

Sorting data is a common need in many applications. If you have thought about writing your own sorting routine, you likely came up with a scheme that picked the first data item, and then compared it to each of the other elements to find a smaller value (if sorting into ascending order) or a larger value (if sorting into descending order). Finding a match, you switch the two values in your list of data.

Gradually, as you scan the list, the smallest (or largest) value bubbles up to the front of the list. Once the whole list is scanned, you have found the smallest (or largest) value and switched it to the beginning.

Then you would start with the next data value and compare it to the remaining data values. And so on.

Great idea if you came up with this – seriously! In computer science algorithms, this is known as the “bubble sort”. It works fine – but it has one problem – as the number of items to be sorted grows, the time it takes to do the sort grows even faster.

In fact, we say that a bubble sort runs in a time proportional to n^2 (n squared). If there are 10 items to sort, this will take 10^2 or 100 time units to sort.

If there are 30 items to sort, this will take 30^2 or 900 time units to sort. Just going from 10 items to 30 items adds 800 time units to our sorting time! Ouch!

As you can see, the bubble sort is simple but it can take a long time to run!

Computer scientists have invented other ways to sort data. One of the best known has the descriptive name “QuickSort”. In many cases, it’s sorting time is on the order of n ln n (that is n times the natural logarithm of n).

If we compare that to the Bubble Sort for n=10, we get 23 time units and for n=30, we get 103 time units. As you can see, QuickSort is much faster than the Bubble Sort.

Continue reading

appinventor.pevest.com has moved to appinventorplus.wordpress.com

The old URL http://appinventor.pevest.com automatically redirects to the new URL at https://appinventorplus.wordpress.com

The old RSS newsfeed at appinventor.pevest.com/?feed=rss2 automatically redirects to the new RSS newsfeed at https://appinventorplus.wordpress.com/feed/

If you subscribed to the blog via email, you must re-subscribe by going to the new blog URL and clicking on the Follow link near the top of the rightmost column.

If you read this blog via Facebook or Twitter, you do not need to do anything. Tumblr is not yet configured but will be soon.

Old page links, such as those on the Facebook group page like: http://appinventor.pevest.com/?p=1579

will continue to bring up the old pages, making it easy to access older material.

Most comments – except those entered in the past few days – were migrated to the new blog URL. Comments entered in the past few days (after the content was migrated but before the switch over was completed) appear here but not on the new blog.

Benefits of the new web site

  • FASTER web site access and display of web pages
  • SECURE web site access using https – this prevents Internet Service Providers, government agencies and others from spying on what you are reading online.
  • AUTOMATIC SHARING to Facebook, Twitter, Google+ and soon Tumblr. Previously I had to manually cross post items to Facebook and Google+ – and I was rarely getting caught up with Google+. Now the updates will be automatic!
  • EASIER UPDATES as I consolidate my blogs into WordPress, I will have a single interface to reach any of them, which makes publishing easier and faster.
  • MORE TIME for me as I no longer have to maintain the continuous software updates and debugging of multiple web sites. That means more time to post new App Inventor tutorials!

The only feature we lose – I think – is the summary page that automatically created a 2 or 3 line summary of each post and placed those into a single page.

Web site migration update and info on next tutorial/sample code

I posted this item last night, but took it off line as I discovered problems with my web site migration. I stayed up much of the night fixing that – and then we had no electrical power most of today due to a wind storm.
—————————
I completed a migration of my coldstreams.com Internet of Things blog to WordPress. This is a test case before I flip the switch on appinventor.pevest.com redirecting to appinventorplus.wordpress.com.

The process was more complex than I expected, especially getting the automatic redirection to the new web site working as intended. However, with that process understood now, the migration of App Inventor 2 – Learn to Code to the new server will hopefully be able to happen soon and go more smoothly. If you would like to learn how to do this and what I had to do, I’ve written this up to help others: https://coldstreams.wordpress.com/2017/04/08/how-to-move-a-self-hosted-wordpress-blog-to-wordpress-com/

Once these migrations are done, I will be able to focus on creating content and no longer have to spend so much time managing servers!

I expect my next tutorial to be on how to sort data in App Inventor.

A reader has a collection of data with both a name, and a score (it is something else but it is like a score) and would like to sort the collection sometimes by name and sometimes by score.

There are several ways to sort data – some are obvious but slow while some are really fast. My goal is to show how to implement a fast sorting algorithm that works with a list of lists.

In this concept, we will have a list of data, where each element in the list is itself a list. Sounds confusing but the idea is that we can store a data record in each list element and lists are how App Inventor stores records. This means our list will look something like:

Chang, 89
John, 86
Daksha, 92
Samantha, 91
Chandra, 90
Johan, 87
Patty, 94

When we sort by name, we want Chandra as name 1, then Chang as name 2, Daksha as name 3 and so on, with the corresponding scores still attached to their names.

We will do this with our sorting code.

Migrating this blog to a new web site

After running and managing my own blog software since 1995 – all the way back to the beginning of the web! – I am gradually migrating my blogs to WordPress.com. That means the appinventor.pevest.com web site will be switching over to WordPress.com hosting.

I currently run 5 web sites. Managing all of them with frequent software updates, maintenance, anti-malware screening, anti-spam screening, comment review is too time consuming. Plus, I need to convert them over to https secure web access. In reviewing  this, I realized the era of my hosting my own blogs is coming to an end.

Most of the change over will be transparent. You can visit the preliminary new web site here:

appinventorplus.wordpress.com

When I make the switch from this web site to the new one, I will initially just redirect access to appinventor.pevest.com directly to appinventorplus.wordpress.com. I may eventually set it up so that the appinventor.pevest.com domain name replaces appinventorplus.wordpress.com. I also plan to purchase a monthly WordPress subscription so the WordPress ads will go away.

I have 5 web sites to convert and that takes time too. But once done, I will no longer have to spend so much time on the day to day maintenance of my blogs and web sites.