The image is from an article titled, Why I don’t regret moving our Android app to Scala.
I’ve currently written this document as a “note to self” about how the Android
AsyncTask works. It’s currently incomplete, but if you want to know how an AsyncTask works, most of the answers are generally here. I provide documentation for most aspects of the
AsyncTask, though my coverage of (a) updating progress/status and (b) canceling an
AsyncTask is a little weak atm.
I just got back into using an Android
AsyncTask, and it took me a little while to re-load the concepts in my head. I used
AsyncTask’s a few years ago, but haven’t used them since.
To help remember how they work, I created a little
AsyncTask example project, and I’ve included all of the source code for that project here. I’ll show all of the source code for my classes and configuration files, and then explain the code at the end.
As a note to self, here are some Android Room database persistence library examples:
Those tutorials don’t show how to properly use Room database access methods, so they’ll lead to Android “Application Not Responding” (ANR) errors. Therefore, here are some related Google/Android docs:
Finally, here’s my own Android AsyncTask REST example, which also shows how to use an
I was just working with an example of how to use Android’s new Room Persistence Library, and the example I was working with ran some of its code on the main Android thread, also known as its “UI thread.” I knew this was bad, but I wanted to start with someone’s example, and then figure out a good way to get the Room method calls to run on a background thread, such as using an
AsyncTask. (The Android docs don’t specify a “best practice” for this atm.)
FLiB is a fast, free internet browser for Android devices. Read on for more details ...
As a brief note, today I tried to list the files in my Android application, which was running on a physical Android device — a Nexus 9 — with this
adb shell command:
adb shell com.alvinalexander.mybrowser ls /data/data/com.alvinalexander.mybrowser
When I did that, I got an Android/ADB “permission denied” error.
The short story is that a solution to this problem is to run the same command, but with the
run-as argument, like this:
When you need to reference a drawable image from an Android XML file, such as a layout or menu file, use this tag:
That assumes that you have a file named myimage.png in your res/drawable directories. As a more complete example, this shows how I reference an image named images_show.png in an Android menu item: