Is not possible send the same Message instance several time, only once. So we always have to create a new instance. Better than that, instead of create a new instance (new Message()), we can use the method obtain (Message.obtain()) that will return a recycled instance of Message from the pool of recycled objects, what is … Continue lendo Message.obtain() and new Message() – TIP
Categoria: Android
Service restart behavior – Compilation
START_STICKY Service is restarted if it gets terminated. It will tell the system to create a newest copy of the service, when available memory is sufficient to do, after it retains state and recovers from the low memory. In this process we will loose the results that might have calculated before. onStartCommand() will be called on the … Continue lendo Service restart behavior – Compilation
Retrofit 2.0 – URL concept
I struggled with the new URL way when I started to use this new version. But it's easy to understand (after miss much because of the old version vices)! Just keep in mind that the base URL and specific URL of a resource are concatenated. So, you must to take care with '/' at the … Continue lendo Retrofit 2.0 – URL concept
Fast Step-by-Step to Get Location
Configuration Add Gradle dependency: https://gist.github.com/tassioauad/6806c683661bf3286569202a99e28915 Add permission on AndroidManifest.xml https://gist.github.com/tassioauad/e12cb1ad5720ac7019e3b12b6c682d5a More about ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATION. Using the GoogleApiClient At first, we need to instanciate the GoogleApiClient, because throught this instance we can access any service from Google Services, like the Location Service. It is a client for ALL services of the Google Service API (Location, … Continue lendo Fast Step-by-Step to Get Location
Tip about the Handling Configuration Changes in a Relationship between Activities and Fragments
I've sometimes posted about configuration changes, screen rotations and etc, but now I will write about a mistake that I made at the beginning when this handling involves Activity and Fragments. Let's take as example a simple Activity with a Fragment. We have to handle the configuration changes of the activity and the fragment and … Continue lendo Tip about the Handling Configuration Changes in a Relationship between Activities and Fragments