private void performAction(int action, JsonElement responseData) { JsonObject data = null; JsonArray dataArray = null; if (isArrayResponse) { dataArray = responseData.getAsJsonArray(); } else { data = responseData.getAsJsonObject(); } switch (action) { case SET_USER_ID: HarpoonSDK.setUser(data.toString()); HarpoonSDK.setUserId( data.get("id").getAsString(), data.get("authorization_code").getAsString()); break; default: break; } }
private String getString(int resId) { if (HarpoonSDK.getContext() == null) { throw new NullPointerException("SDK context is not initialised!"); } return HarpoonSDK.getContext().getString(resId); }