Android, api, Programming

How to implement AlarmManager using AlarmSetter API

How to setup the AlarmManager has been so complex. For Android developers, there is this need for creating a way your app can perform some background tasks even after the app has been closed. There are times when we tell the service to sleep for a specified period of time and then wake up to… Continue reading How to implement AlarmManager using AlarmSetter API

Advertisements
Java, Programming

How to convert file size into reader friendly format

File size and device capacity are by default expressed in length using long number. That number is expressed in byte (B). Unfortunately, it is hard to read the size when it becomes big like 1234567890B. So you need to use their multiples to simplify the reading. Common units are B, KB, MB, GB, TB. So… Continue reading How to convert file size into reader friendly format

Android, Gradle, Programming

How to retrieve version name and version code programmatically

Need usually arises when you want to display the version name and code in you program at runtime, in About dialog or in any other places. Some programmers just hardcode them in About dialog. So each time they increase the version code and name, they need to remember to manually change everywhere in the codes… Continue reading How to retrieve version name and version code programmatically

Java, Programming

How to convert a date from one String format to another using SimpleDateFormat

In this tutorial, I will show you how in not more than 2 lines of codes I can convert from one format to another. To begin, we will start with a quick reminder for SimpleDateFormat. When creating a SimpleDateFormat object, pass in the constructor the string pattern. There are many other constructors for the SimpleDateFormat… Continue reading How to convert a date from one String format to another using SimpleDateFormat

Java, Programming

HOW TO IMPLEMENT CALLBACK METHODS IN JAVA

In my tutorial, I will use simple terms where necessary to help you grasp the logic. A callback in a larger sense of terms is like a listener. It listens to an event and reports back. In this tutorial, we will discuss callback methods rather than callback classes. In listeners case, we need at least… Continue reading HOW TO IMPLEMENT CALLBACK METHODS IN JAVA