public void getData(final Activity act) { if (null != mTask) { mTask.cancel(true); } mTask = new GetLikeDataTask(act) { protected void onPreExecute() { super.onPreExecute(); if (null != loadingLayout) loadingLayout.setVisibility(View.VISIBLE); Log.i("LIKE_DATA", "START"); }; protected void onPostExecute(String result) { Log.i("Men", "END"); if (null != mList) mList.setVisibility(View.VISIBLE); if (null != loadingLayout) loadingLayout.setVisibility(View.GONE); super.onPostExecute(result); }; public void onSuccess() { Log.i("Men", "END231"); try { mArtists = Statics.likeDatas; int likeCount = 0; for (Artist art : mArtists) { if (art.getSongs() != null) { likeCount += art.getSongs().size(); } } if (null != aAdapter) { Log.d("Men", "Updated Adapter"); aAdapter.setData(Statics.likeDatas); } else { Log.d("Men", "OnactivityCreatedAgain : " + mArtists.size()); getViewTmp(); } } catch (Exception e) { e.printStackTrace(); } }; }; mTask.execute(); }
@Override public void onDestroy() { if (null != mTask) mTask.cancel(true); super.onDestroy(); }