Esempio n. 1
0
 public void handleMessage(Message message) {
   if (message.what == 0) {
     if (message.obj instanceof IOException) {
       if (!DeviceResourceAPI.isNetworkAvailable(ShowSingerActivity.getInstance())
           && isFirstShowLinkDialog) {
         //						StartNetWork.setNetworkMethod(ShowSingerActivity.getInstance(),
         // ShowSingerActivity.getInstance(), "cancel");
         isFirstShowLinkDialog = false;
         return;
       }
     } else if (message.obj instanceof JSONException) {
       Alerts.showAlert("提示", "解析异常", "确定", "", CenterActivity2.getInstance());
     } else if (message.obj instanceof HttpException) {
       Alerts.showAlert("提示", "请求异常", "确定", "", CenterActivity2.getInstance());
     }
   } else if (message.what == 1) {
     if (message.arg1 == ACTION.GETSINGERVOTES.ordinal()) {
       SingerListAdpter singerListAdpter =
           new SingerListAdpter(
               (List<SingerBean>) message.obj,
               ShowSingerActivity.getInstance(),
               ShowSingerActivity.getInstance().getScreen_width());
       ShowSingerActivity.getInstance().getSingerListView().setAdapter(singerListAdpter);
       ShowSingerActivity.getInstance().refresh_login("mango");
     }
   }
 }
Esempio n. 2
0
 @Override
 public void onComplete(String response, ACTION action) {
   Log.d(LOG_TAG, response);
   Message message = Message.obtain();
   try {
     message.arg1 = action.ordinal();
     if (action.equals(ACTION.GETSINGERVOTES)) {
       if (SnsAPI.get_allSns().get("mango").getSid() != null
           && !SnsAPI.get_allSns().get("mango").getSid().equals("null")) {
         JsonForDate.voteSinger(response, ShowSingerActivity.getInstance().getSingerBeans());
       } else {
         JsonForDate.getSingerVotes(
             response, ShowSingerActivity.getInstance().getSingerBeans());
       }
       message.what = 1;
       message.obj = ShowSingerActivity.getInstance().getSingerBeans();
     }
   } catch (JSONException e) {
     e.printStackTrace();
     message.what = 0;
     message.obj = e;
   }
   singerVotesServiceHandler.sendMessage(message);
 }