android

android tips and tutorials

Android/Kotlin: A FragmentStatePagerAdapter (in TabLayout) example alvin December 1, 2018 - 2:48pm

As a note to self, here’s an example of implementing a FragmentStatePagerAdapter Android class in Kotlin:

Android/Kotlin: A FloatingActionButton setOnClickListener Snackbar example alvin November 30, 2018 - 4:28pm

As a quick note to self, this is an example of how to implement a setOnClickListener on a FloatingActionButton with Android and Kotlin:

fab.setOnClickListener { view ->
    Snackbar.make(
        view,
        "An exciting message!",
        Snackbar.LENGTH_LONG
    ).setAction("Action", null).show()
}

Hopefully that’s enough to get “future me” pointed in the right direction when I need this again. :)

(There are more lambda details at this link.)

Amazon Fire 10 HD: 33% off on Black Friday, 2018 alvin November 23, 2018 - 10:44am

I need a new tablet, and I just might bite the bullet on the Amazon Fire 10 HD today (Black Friday, 2018). For my Android development I don’t like that it’s based on Android 5, but $100 (33% off its regular price) for a tablet with decent performance is hard to pass up for my current needs.

How to make a phone call from your Android app alvin March 12, 2018 - 10:45pm

I came across this Android phone dialer tip yesterday. If you want to make a phone call from an Android application, all you have to do is create a new Intent, either an Intent.ACTION_DIAL (to start the call) or Intent.ACTION_CALL (to place the call).

Here are the three lines of source code you need to get started:

Intent dialIntent = new Intent();
dialIntent.setAction(Intent.ACTION_DIAL);
dialIntent.setData(Uri.parse("tel:8675309"));
Android users have a higher loyalty than iOS users alvin March 10, 2018 - 5:44pm

A new study shows that Android users have a higher “loyalty” to their OS than iOS users have, 91% to 86%. techcrunch.com has the story.

The most read “Google Play” posts on Medium in 2017 alvin December 28, 2017 - 6:46pm
Libgdx and Android application Lifecycle alvin December 25, 2017 - 7:18pm

This is a good resource for LibGDX programming on Android.

How to transfer very large files to an Android device with adb alvin December 13, 2017 - 8:26pm

Today I learned that the Android File Transfer tool has a 4GB data transfer limit, but I was able to get around that by using the adb (Android Debug Bridge) command. The short story is that I used this adb command to transfer a 6GB file to my Android system, an old Nexus 9:

How Google is powering the world’s AI alvin November 27, 2017 - 8:06am

AndroidAuthority.com has a good, detailed article titled, How Google is powering the world’s AI.

Google is introducing a Neural Networks API in Android 8.1 developer preview alvin October 26, 2017 - 7:18pm

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.”