Android Open Source - filmster J S O N Parser From Project Back to project page filmster .
License The source code is released under:
Apache License
If you think the Android project filmster listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code package com.doodeec.filmster.Model;
/ / f r o m w w w . j a v a 2 s . c o m
import android.util.Log;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/**
* Created by Dusan Doodeec Bartos on 20.10.2014.
*
* Simple JSON parser - wraps methods around try-catch blocks
* Handles JSON exceptions
*/
public class JSONParser {
protected static Integer getIntForKey(JSONObject jsonObject, String key) {
Integer value = null;
try {
value = jsonObject.getInt(key);
} catch (JSONException e) {
Log.e("Error reading integer" , e.getMessage() + " in object: " + jsonObject.toString());
}
return value;
}
protected static String getStringForKey(JSONObject jsonObject, String key) {
String value = null;
try {
value = jsonObject.getString(key);
} catch (JSONException e) {
Log.e("Error reading string" , e.getMessage() + " in object: " + jsonObject.toString());
}
return value;
}
protected static JSONObject getObjectForKey(JSONObject jsonObject, String key) {
JSONObject value = null;
try {
value = jsonObject.getJSONObject(key);
} catch (JSONException e) {
Log.e("Error reading JSON object" , e.getMessage() + " in object: " + jsonObject.toString());
}
return value;
}
protected static JSONArray getArrayForKey(JSONObject jsonObject, String key) {
JSONArray value = null;
try {
value = jsonObject.getJSONArray(key);
} catch (JSONException e) {
Log.e("Error reading JSON array" , e.getMessage() + " in object: " + jsonObject.toString());
}
return value;
}
}
Java Source Code List com.doodeec.filmster.HelperSpec.java com.doodeec.filmster.Helper.java com.doodeec.filmster.ImageCacheSpec.java com.doodeec.filmster.ImageCache.java com.doodeec.filmster.MainActivity.java com.doodeec.filmster.Mock.java com.doodeec.filmster.ApplicationState.AppStateSpec.java com.doodeec.filmster.ApplicationState.AppState.java com.doodeec.filmster.ApplicationState.ConnectionStateChange.java com.doodeec.filmster.Model.JSONParserSpec.java com.doodeec.filmster.Model.JSONParser.java com.doodeec.filmster.Model.MovieDefinitionKeys.java com.doodeec.filmster.Model.MovieSpec.java com.doodeec.filmster.Model.Movie.java com.doodeec.filmster.MovieDetail.MovieDetailFragmentSpec.java com.doodeec.filmster.MovieDetail.MovieDetailFragment.java com.doodeec.filmster.MovieList.MovieListActivityInterface.java com.doodeec.filmster.MovieList.MovieListAdapterSpec.java com.doodeec.filmster.MovieList.MovieListAdapter.java com.doodeec.filmster.MovieList.MovieListFragmentSpec.java com.doodeec.filmster.MovieList.MovieListFragment.java com.doodeec.filmster.MovieList.MovieListItemHolderSpec.java com.doodeec.filmster.MovieList.MovieListItemHolder.java com.doodeec.filmster.Provider.DbHelperSpec.java com.doodeec.filmster.Provider.DbHelper.java com.doodeec.filmster.Provider.MovieEntry.java com.doodeec.filmster.Provider.MovieProviderSpec.java com.doodeec.filmster.Provider.MovieProvider.java com.doodeec.filmster.ServerCommunicator.ResourceServiceSpec.java com.doodeec.filmster.ServerCommunicator.ResourceService.java com.doodeec.filmster.ServerCommunicator.ResponseListener.BitmapServerResponseListener.java com.doodeec.filmster.ServerCommunicator.ResponseListener.JSONServerResponseListener.java com.doodeec.filmster.ServerCommunicator.ResponseListener.ServerResponseListener.java com.doodeec.filmster.ServerCommunicator.ServerRequest.ErrorResponseSpec.java com.doodeec.filmster.ServerCommunicator.ServerRequest.ErrorResponse.java com.doodeec.filmster.ServerCommunicator.ServerRequest.ServerRequestInterface.java com.doodeec.filmster.ServerCommunicator.ServerRequest.ServerRequestSpec.java com.doodeec.filmster.ServerCommunicator.ServerRequest.ServerRequest.java