android tips and tutorials

Google is introducing a Neural Networks API in Android 8.1 developer preview

Several media outlets are reporting that Google is introducing their Neural Networks API in developer preview of Android 8.1. TechCrunch has a well-written article that includes this:

“The big highlight here is the new Neural Networks API, which brings hardware-accelerated inference to the phone for quickly executing previously trained machine learning models. Bringing these calculations to the edge can bring a lot of utility to the end user by reducing latency and load on the network, while also keeping more sensitive data on-device.”

Making the switch, from iPhone to Android

The comical part of my recent surgery was that my iPhone 5S kept dying, both before and after the surgery. Something is going on where the iPhone completely loses reception, and the only way to fix it — the only hope of fixing it — is to completely restore the phone using a secret handshake technique they taught me at the local Apple Store. (They also told me this technique only works about 10% of the time, and kindly suggested I buy a new iPhone because the 5S is almost four years old.)

Android: How to send a message from a Thread to a Handler

As a quick example of how to use a Thread with a basic Handler in an Android application, the following code creates a view where the text in the TextView is updated to show the current date and time when the Button is tapped.

Java source code

First, here’s the Java source code for a file class named ThreadHandlerActivity:

Code snippets for rapid prototyping of Android Studio apps

This is a list of Android code examples I’m starting to allow me to create rapid prototypes of Android applications using Android Studio. This is a very early list, I hope to be adding many more Android code snippets over time.

Android source code to show a popup dialog with a text field

I am working on a way to rapidly mock up Android applications using Android Studio, i.e., to rapidly prototype Android applications on the fly, and little snippets of code help to make this happen. For instance, this snippet of code shows how to show a popup dialog to prompt a user to enter information into a text field: