Photo by Campaign Creators on Unsplash

TL;DR: A WITHOUT ROWID table can reduce DB size and perform query faster than an ordinary rowid table.

A good strategy is to simply not worry about WITHOUT ROWID optimization until near the end of development, then go back and run tests to see if adding it helpul or not.

SQLite rowid

By default, every row in SQLite has a special column — usually called rowid.

rowid can be used to uniquely identifies a row within the table.

For example, create a new table:

CREATE TABLE TopRatedFilm(
movie TEXT,
studio TEXT,
rating REAL
);

As a result, SQLite creates rowid beginning with…


Photo by Ferenc Almasi on Unsplash

TL;DR: To write JVM unit test for Android build version, you can: Modify the build version field at runtime or Create a wrapper for build version checking.

By the arrival of Android Q last year, Google has released 17 Android versions with many different APIs — that need to be checked during runtime execution to implement corresponding behavior.

Build.VERSION

To fetch information about the version that your device is running on, you need to access Build.VERSION class:

SDK_INT: The SDK version of the software currently running on this hardware device.

Look at the code, you will see that it gets the…


Photo by Caspar Camille Rubin on Unsplash

TL;DR: The plus sign in “@+id/” tells Android build tools that you are declaring a new resource. And if it does not exist, add to R.java file.

But basically, you don’t have to think, just use “@+id/” anywhere you want!

In Android, when dealing with XML layouts, we come across the ID attribute in the View or Layout tags. From the beginning, we learn that it will assign or refer the id of this View/Layout. However, you might have noticed that they are different variations:

  • android:id="@android:id/myView"
  • android:id=”@+id/myView”
  • android:id="@id/myView"

So in what cases are they used?


Photo by Arian Darvishi on Unsplash

Recently, I often get questions from university students like:

  • “My coding skill is not too bad, but I often have to search on Google for code references — even with basic functions of programming language, don’t know if it’s terrible?”
  • “I usually go to Stack Overflow to find solutions for my problems, so will I become a bad developer? Should I look for a new career path?”


Photo by Matteo Grassi on Unsplash

TL;DR: You can create utils class by putting methods inside an object, or use package-level functions.

If you’re integrating with Java code and need a true static utils method, you can put this method inside an object and annotate it with @JvmStatic.

For those who don’t know, Kotlin is a cross-platform, statically typed language with type inference. Kotlin is designed to interoperate fully with Java, and the JVM of its standard library depends on the Java Class Library.

Kotlin is sponsored by JetBrains and Google through the Kotlin Foundation. Now is a good time to consider to use Kotlin for…


Photo by Thomas Jensen on Unsplash

Today when preparing for the Computer Network exam, I would like to share some basic things about Private IP and Public IP.


Photo by Alexander Schimmeck on Unsplash

Today I’m working on a school project of Software Design which need to use OOP, so I decide to write a small article about Constructor and Inheritance in C#

When initializing new object of a subclass, constructor of the parent class will be called first, after that constructor of the subclass will be called.

For example, I have Base and Child class (inherited from Base) as follows:

Run the program, you’ll see the constructor of the Base has been called first!


Image from Android Studio

TL;DR: You can manage your resources XML files (layout, drawable,..) better, by grouping them into separate subfolders corresponding to app’s features.

Today when optimizing the codebase of my school project, I saw this:


Photo by Simon Abrams on Unsplash

If you can read this:

  • You are not starving or lack food supply.
  • You have attended at least one year of primary school education — that’s why you can read and write.
  • Your country is not in a war.
  • You have access to electricity.
  • You have at least one electronic device (PC, mobile phone,..) to visit Medium.
  • You have access to the Internet.
  • You don't have to work 16 hours per day, so you have the time to read.

If you are a software developer:

  • You have at least one PC.
  • You have an opportunity with higher education, to learn…


Welcome to the Android world!

Virtual Machine?

A virtual machine is based on computer architectures to provide functionality of a computer.

There are 2 main types of Virtual Machine (VM):

  • System virtual machines (full virtualization VMs) provide a substitute for a real machine.
  • Process virtual machines are designed to execute computer programs in a platform-independent environment.

Tam H. Doan

Software Engineer, also a Runner and Guitarist.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store