android

android tips and tutorials

Android flashcards

One thing I learned about ten years ago is that when I need to memorize things, flashcards work really well for me. More recently, because I often bounce between many technologies, I have been making flashcards as a way of bringing me back up to speed after I’ve been away from a technology for a while.

The image shows one example of this, where I created a stack of flashcards to help me remember/relearn Android, which I haven’t used in several months. In this case I also have my Android cheat sheet to fall back on, but even then I still like using the flashcards. I think the theory is that rather than reading something passively, flashcards force you to try to recall something, and that’s a much more active way of using your brain and memory.

Android: How to go back to Google App stories after closing the Now card

I like the “Google” app on Android — the thing you see if you swipe right on the Android home screen. But a weakness of it is that you can’t get back to a story easily. For instance, this morning I followed a Google Now card to see a story about Tom Ricketts and the Cubs, closed the story, then thought, “Wait, I meant to look at XYZ in that web page.” Once you close a story like this the Now card disappears, and you can’t get back to it easily (which is the weakness).

Solution 1: Going back to Google Now app stories on Android 7

I don’t know if this is the only way to do it, but as a solution, one way to get back to the story on Android 7 is to follow these steps:

How to use the Android 7 split screen feature (tutorial)

Android 7 comes with a cool new “split screen” feature where you can look at two apps running at the same time. This little pictorial/tutorial shows how to use this split-screen feature.

Back to top

How to use Android’s split-screen feature

Step 1: Open two or more apps

The easiest way to get started with this feature is to have two or more Android apps open. You may want to open more than two apps, because some apps won’t support the split-screen feature. For instance, at the time of this writing, Kindle and Netflix don’t support it. I recommend starting a browser like Chrome, and another app like Twitter or an email app.

Tip: When you’re first getting started, open a few Google apps. They are more likely to work in split-screen mode than other apps.

Step 2: Tap the Android “recent apps” icon

Google might do well to buy Yahoo Finance

Google might do well to buy Yahoo Finance, if just that part is available for sale. I was just using the Yahoo Finance app on my Android Nexus 9 tablet, and for a few moments I forgot that I was using an Android app; it was so smooth I thought I was using an iOS app. The more great apps like that on Android, the better.

Conversely, the Yahoo Mail app on Android is just an average Android app, imho. The 2015 release was much better than earlier versions, but it still has a long ways to go to be a great app.

When you want to store static text in an Android file

As a note to self, when you’re writing an Android application and you think you want to store some static text in an external file, a better approach can be to create a resource file under res/values.

For example, I’m currently adding some help text to an Android app, and to do that I created a file named strings_help.xml under the res/values directory. That file contains HTML wrapped in an XML CDATA tag, like this:

Android - “Freemarker NoClassDefFoundError TextBlock” error message

I don’t remember the exact error message, but if you’re trying to use FreeMarker with Android and you get an error that says something like “Freemarker - NoClassDefFoundError TextBlock”, the root cause of the problem seems to be that FreeMarker uses the java.beans library under the hood, and the Android version of Java does not implement this. As a result, FreeMarker won’t work with Android, at least not without some modifications, as of January, 2016.

How to create an Android Color from a hexadecimal/HTML string (#fff)

Android FAQ: How can I create a Color from a hexadecimal color string in Android?

The Android Color.parseColor method

Solution: Use the Android Color.parseColor method, like this:

int color = Color.parseColor("#519c3f");

I just used it like this in my code, where I directly set the Paint color:

An Android method to center text when using Canvas drawText

I’m not an expert on this subject just yet, but if you want the source code for an Android method to center text that you want to use with the drawText method of the Canvas class, I know that this code works in two places in my current Android app: