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
Tag: 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
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
Retrofit 2.0 — Just a Tip
Yes, I'm late to post about Retrofit, but this post is in my drafts box there is a long time! =D It will not be a big post explaining each detail of this framework even because I'm late (again) and there is already lot of posts doing this job . I will try to do something diferente, … Continue lendo Retrofit 2.0 — Just a Tip