:::: MENU ::::
Browsing posts in: Development

Android: draw LatLngBounds on a GoogleMap object

Quick question: If you have a LatLngBounds variable how to transform it to a polygon and draw it on a Google Map view in your Android Application?

LatLngBounds store a rectangle by storing only 2 points from the rectangle the North East and South West, to build a new polygon you need the rest of the points.


public void onMapReady(GoogleMap googleMap) {
   // get the bounds, for this example I will get the visible region on the google map view
   LatLngBounds b = mapObj.getProjection().getVisibleRegion().latLngBounds;

   PolygonOptions po = new PolygonOptions();

   LatLng northwest = new LatLng(b.southwest.latitude, b.northeast.longitude);
   LatLng southeast = new LatLng(b.northeast.latitude, b.southwest.longitude);

   po.add(b.northeast, northwest);
   po.add(northwest, b.southwest);
   po.add(b.southwest, southeast);
   po.add(southeast, b.northeast);



Handle Windows folders with space in terminal

This is a tricky issue for someone with is not used to work with a dos terminal in windows.

So for short if you have a path like C:\Program Files\Java\jre1.8.0_73 you have a space and from DOS terminal that space is a issue.

Next 3 examples will handle that space.

cd "C:\Program Files\Java\jre1.8.0_73"
cd C:\Program^ Files\Java\jre1.8.0_73

First on first line I added the path in “”, on the second line I did escaped the space but not with a \ like you are used in linux enviroments but with a ^

Android issue: INSTALL_FAILED_UID_CHANGED fixed without root or device factory reset

If you are here you probably had the issue from the title the error INSTALL_FAILED_UID_CHANGED when you want to install for debug the app from Eclipse or Android Studio.

I had this issue yesterday and after hours of browsing the stackoverflow and groups and forums I found 3 methods to fix this.

1. if you test on an emulator then you just have to Clear/Wipe the AVD to defaults or create a new one.

2. you are on a real device. If you have root access to the device just go to folder


and delete it. You should ok now.

3. Device with no ROOT Access. On internet there is just one single method to factory reset the device. If this is acceptable for you this is easy.

None of this methods was OK for me. I was testing on a real device with NO-ROOT but I did not want to factory reset it. Continue Reading

Mobile AppWidget for WordPress a new way to promote mobile apps on your blog

Mobile AppWidget is a wordpress widget witch let any blogger which use wordpress framework to display in the sidebar one simple widget where mobile apps can be promoted.

Mobile app widget sidebar previewOn the left you can see a screenshot of how this plugin will display the Ad for a mobile app.

In this case an Android app is showed, however if the app is made for iOS or Windows Phone  or if it has versions for all mobile platforms links for them are displayed. Continue Reading

How to detect left mouse click and right mouse click with jQuery

If you want to implement a javascript interface probably you will get to a point where you have to know witch button was pressed. The next code will detect correctly for IE, Firefox, Chrome, Opera and Safari.

/* this will append click detection to whole document
 * if you want to add this feature just on one area
 * just change the selector for the jQuery
jQuery(document).click(function(event) {
   if (jQuery.browser.msie){
      if (event.which < 2){
         alert('Left button');
   switch (event.which) {
      case 1:
         alert('Left button');
      case 2:
         alert('Middle button');
      case 3:
         alert('Right button');


Continue Reading

MySQL: Select “last month” records

In order to select last month records you have to get first day of the last month and the last day of the first month. With this you use the mysql function BETWEEN.

Remember that current month could be January and the last month will in another year.

Finding first day of the last month:


Finding the last thay of the last month:


And the final Query is:

FROM `my_table`

How to write & (ampersand) character in Android string resource

Because ampersand or & character break the xml validation in Android string.xml file if you need to insert a text with ampersand you have to encode it like in HTML encode.


<string name="mystring">This is my test & example</string> <!-- this is not ok -->

correct wayWatch movie online Get Out (2017)Watch movie online The Lego Batman Movie (2017)

<string name="mystring">This is my test &amp; example</string> <!-- this is not ok -->

How to open new window with window.open and not be seen by chrome a popup

If in the command stack the window.open is not direct under the onClick event then the new window it must be a popup. If the browser is set to block popups the new window will be blocked.

Now in the WEB 2.0 world where ajax calls are a must opening a window after a success ajax call will be seen as a popup Window and Chrome will block this. Continue Reading

Android get versionCode and versionName from your AndroidManifest.xml

Sometimes showing version in your app is a good think, and when you do this a good think is to not have 2 ore more places where wou have to maintain tha app version for every releases.

In your AndroidManifest.xml there is required 2 fields

android:versionCode witch is an int with the app version

android:versionName witch is a string something like 1.0.1 showing app version.

It is recomanded to use them and do not maintain a separate constant for using it in your code. Ok so programmatically you can retrieve this fields from your AndroidManifest.xml like this:

/* Get android:versionName */
String versionName = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;

/* Get android:versionCode */
int versionCode = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;