:::: MENU ::::
Posts tagged with: android

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.

 



....
@Override
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);

   po.strokeColor(Color.RED);

   googleMap.addPolygon(po);
}
...



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 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 -->