Back to project page MapAlarmist.
The source code is released under:
Copyright 2013 Guilhem Vellut <guilhem@vellut.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), t...
If you think the Android project MapAlarmist listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.vellut.geoalarm.io; // w ww .j av a2 s. c o m import java.lang.reflect.Type; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.LatLngBounds; import com.google.gson.JsonArray; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonParseException; public class LatLngBoundsDeserializer implements JsonDeserializer<LatLngBounds>{ @Override public LatLngBounds deserialize(JsonElement element, Type arg1, JsonDeserializationContext arg2) throws JsonParseException { JsonArray arr = element.getAsJsonArray(); LatLng southwest = new LatLng(arr.get(0).getAsDouble(), arr.get(1).getAsDouble()); LatLng northeast = new LatLng(arr.get(2).getAsDouble(), arr.get(3).getAsDouble()); LatLngBounds zone = new LatLngBounds(southwest, northeast); return zone; } }