@Override protected void onPostExecute(String result) { try { listener.onNetEnd(result, method); } catch (NullPointerException e) { e.printStackTrace(); } if (OtherCacheData.current().isDebugMode) Log.e(TAG, "finished"); super.onPostExecute(result); }
@Override protected String doInBackground(Object... params) { Context context; MySpaceRequest request; LoginNewParser parser; String data; context = (Context) params[0]; listener = (NetConnectionListener) params[1]; request = (MySpaceRequest) params[2]; parser = (LoginNewParser) params[3]; data = request.make(); if (OtherCacheData.current().isDebugMode) Log.e(TAG, data); listener.onNetBegin(method); String s = NetUtil.execute(context, data, null); if (s != null) { if (OtherCacheData.current().isDebugMode) Log.e(TAG, s); String result = parser.parse(s); return result; } else { return null; } }
@Override public String make() { JSONObject holder = new JSONObject(); try { holder.put("method", "hotPlay"); holder.put("version", JSONMessageType.APP_VERSION); holder.put("client", JSONMessageType.SOURCE); holder.put("jsession", UserNow.current().jsession); } catch (JSONException e) { e.printStackTrace(); } if (OtherCacheData.current().isDebugMode) { Log.e("HotPlayRequest", holder.toString()); } return holder.toString(); }
@Override protected void onCancelled() { listener.onCancel(method); if (OtherCacheData.current().isDebugMode) Log.e(TAG, "canceled"); super.onCancelled(); }