Monday, 27 June 2016

Google Maps - Get the center point

Now a day we have apps like Uber or Careem which has a fix point to the center of the map. To get the latitude and longitude of the center of the map, do the follow:

// Get the center of the map and update it as the camera changes
mGoogleMap.setOnCameraChangeListener(new GoogleMap.OnCameraChangeListener() {
    public void onCameraChange(CameraPosition cameraPosition) {
        LatLng mapCenterPoint =;
        Log.v(TAG, "The center of the map is " + mapCenterPoint);

Where mGoogleMap is the type of GoogleMap.

Tuesday, 21 June 2016

Android Alpha Table

In Android the colour could be set using the typical HEX colours, where the first two characters are the Red colour, the next two are the Green colour and the next two are the Blue colour (RGB). Beside this, optionally the user can specify the alpha value, which is the level of transparency of the colour. They are also hexadecimal values, which are attached to the beginning.  Here is the format:


Here is a table of the alpha values used:

100% — FF
  95% — F2
  90% — E6
  85% — D9
  80% — CC
  75% — BF
  70% — B3
  65% — A6
  60% — 99
  55% — 8C
  50% — 80
  45% — 73
  40% — 66
  35% — 59
  30% — 4D
  25% — 40
  20% — 33
  15% — 26
  10% — 1A
    5% — 0D
    0% — 00


More colours

Sunday, 22 May 2016

Enabling logs on HuaWei Devices

It seems that HuaWei devices have disabled the logs by default. To see the logs, you got to do the follow:

1. Open dial app
2. Enter the follow number


There is not need to call. A hidden menu will appear as ProjectMenu

3. Click on Background settings

4. Click on LOG Settings

5. Enable all the logs

Happy debugging!

StackOverFlow - Huawei, logcat not showing the log for my app?

Monday, 29 February 2016

Git - Undo previous commit and push

If you have commited and pushed a change to the repository and you want to undo those changes, do the follow:
1. Open the terminal
2. Type

git log

This will give you a list of commits, with the text and the hash code
3. Then type

git revert --no-commit HASH_CODE

Where HASH_CODE is the hash code of the specific commit.

The changes will be in stage. All you have to do now is commit and push.

Friday, 19 February 2016

Playing with Android bootloaders - Some basic concepts learned

So, I was playing with the Android bootloaders for Asus ZenFone 2 and this are some key concepts.

Step 1 - Go to Fast boot mode

This is the basic and first step where we can go to the boot loader.
1.1 Turn on the phone by holding the power button and volume up button (This my vary depends on the brand/model. It is so in Asus ZenFone 2). Hold them until the phone vibrates.
1.2 As soon as the phone vibrates, release the power button but maintain the finger pressed on the volume button.
The phone will start and enter the recovery mode

Step 2 - Update the boot loader (if needed)
Once the phone is in fast boot mode, there two main options:
1. Go to recovery mode
2. Install a new boot loader

Install the new boot loader if needed. There are three files: droidboot.img, recovery.img and boot.img. You could find it on the manufacturer's we page or a third party web page. This is the one for Asus ZenFone 2:

The latest version for now is WW_2.20.40.168

2.1 Download the latest firmware of your brand/model. Unzip it if needed
2.2 Go to the file
2.3 in a Terminal, type the follow:

fastboot devices
fastboot flash fastboot droidboot.img
fastboot flash recovery recovery.img
fastboot flash boot boot.img

Note that the command fastboot is in the same directory as adb, which comes with Android SDK.

3. Flash the latest firmware
To install the latest firmware, there ware two options:
3.1 If you have an SdCard and your phone support it, copy the file into the SdCard.
3.2 If you don't, update it with cable connected to your computer.

3.1 Updating the latest firmware using sdcard
3.1.1 Download the latest firmware and copy it to the main folder of it. Rename it to

3.1.2 Insert the sdcard into the phone
3.1.3 Open fast boot and use the volume buttons to select the recovery mode. Press power button to confirm.

Once in recovery mode, the phone will detect automatically the file in the sdcard and starts to update.

3.2 Updating the latest firmware using cable
3.2.1 In this case, open fast boot and use the volume keys and power button to go to recovery mode.
3.2.2 The phone might show an error because the update file is not in the sdcard. It could be solved by holding the power button (just for a couple of seconds) and press on volume up. As soon as you press on the volume up, you should be able to see a list of options and a log screen below.
3.2.3 Choose the option "apply update from ADB"
3.2.4 Download the latest version of firmware. For Asus ZenFone 2 it could be downloaded from here:
3.2.5 Open the terminal and type

adb sideload

Where is the zip file you downloaded on the step 3.2.4.

The boot loader should detect the adb version and then, it will start updating the firmware.
3.2.6 (Optional)Once it is finished (it takes a couple of minutes), choose the option "Wipe cache partition".
3.2.7 Choose "Restart device " option.

Asus Zentalk - How to receive OTA/ Change FIrmware to WW/ Fix Recovery blinking dropid