Back to project page EnklawaPlayer.
The source code is released under:
GNU General Public License
If you think the Android project EnklawaPlayer 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 macbury.pod.extensions; /*w w w . ja v a 2 s. co m*/ import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonParseException; import java.lang.reflect.Type; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; /** * Created by macbury on 10.09.14. */ public class DateDeserializer implements JsonDeserializer<Date> { private final SimpleDateFormat dateFormat; public DateDeserializer() { dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); } @Override public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { try { return dateFormat.parse(json.getAsString()); } catch (ParseException e) { e.printStackTrace(); return null; } } }