コード例 #1
0
ファイル: LocationService.java プロジェクト: uwitec/hckpApp
        public void handleMessage(Message msg) {

          if (msg.what == 1) {
            LogUtils.i("go thread...");
          }
          super.handleMessage(msg);
        }
コード例 #2
0
ファイル: BianMinPage.java プロジェクト: chsmy/shenghuobao
        @Override
        public void succeed(String name) {
          String city = name;
          LogUtils.i(city);
          String url = SHApi.WEATHER_URL + city;
          loadData(
              HttpMethod.GET,
              url,
              null,
              new RequestCallBack<String>() {

                @Override
                public void onSuccess(ResponseInfo<String> info) {
                  LogUtils.i(info.result);
                  WeatherInfo weatherInfo = WeatherParser.parser(info.result, WeatherInfo.class);
                  ((MainActivity) ct).getMenuFragment().initWeatherInfo(weatherInfo);
                  dialog.dismiss();
                }

                @Override
                public void onFailure(HttpException arg0, String arg1) {
                  showToast(ct.getResources().getString(R.string.networkno));
                  dialog.dismiss();
                }
              });
        }
コード例 #3
0
    @Override
    public void startElement(String uri, String localName, String qName, Attributes attributes)
        throws SAXException {
      super.startElement(uri, localName, qName, attributes);

      LogUtils.i("uri=" + uri + "/localName=" + localName + "/qName=" + qName);
      if (localName.equals("string")) {
        book = new Weather();
      }
      // builder.setLength(0); // 将字符长度设置为0 以便重新开始读取元素内的字符节点
    }
コード例 #4
0
    @Override
    public void endElement(String uri, String localName, String qName) throws SAXException {
      super.endElement(uri, localName, qName);

      LogUtils.i("jieshu;;;;uri=" + uri + "/localName=" + localName + "/qName=" + qName);
      if (localName.equals("string")) {
        book = new Weather();
        book.setName(builder.toString());
        book.setId(index++);
        books.add(book);
        builder.setLength(0);
      }
    }
コード例 #5
0
ファイル: LoginActivity.java プロジェクト: qing0902/Beeway
 /**
  * json字段的解析
  *
  * @param result
  */
 private UserInfo paraseData(String result) {
   Gson gson = new Gson();
   UserInfo userInfo = gson.fromJson(result, UserInfo.class);
   LogUtils.i(userInfo.getStatus() + "");
   return userInfo;
 }
コード例 #6
0
ファイル: LocationService.java プロジェクト: uwitec/hckpApp
 @Override
 public void onDestroy() {
   LogUtils.i("location onDestroy");
   // timer.cancel();
 }
コード例 #7
0
 @Override
 public void onReceive(Context context, Intent intent) {
   CharSequence key_word = intent.getCharSequenceExtra("key_word");
   LogUtils.i("收到广播 key_word= " + key_word);
   etCityName.setText(key_word);
 }
コード例 #8
0
  @Override
  public void callback(String jsonString, int flag) {
    super.callback(jsonString, flag);
    Intent intent;
    switch (flag) {
      case login:
        try {
          JSONObject jsonObject = new JSONObject(jsonString);
          MyApplication.getInstance().setCreationtime(jsonObject.getString("creationtime"));
          MyApplication.getInstance().setPhone(jsonObject.getString("phone"));
          MyApplication.getInstance().setDeliveryaddress(jsonObject.getString("deliveryaddress"));
          MyApplication.getInstance().setExamine(jsonObject.getString("examine"));
          MyApplication.getInstance()
              .setIdNumber(Integer.parseInt(jsonObject.getString("idNumber")));
          MyApplication.getInstance().setStallsname(jsonObject.getString("stallsname"));
          MyApplication.getInstance().setTlr_name(jsonObject.getString("tlr_name"));
          MyApplication.getInstance().setTlr_pwd(jsonObject.getString("tlr_pwd"));
          MyApplication.getInstance().setTlr_type(jsonObject.getString("tlr_type"));
          MyApplication.getInstance().setUserlogo(jsonObject.getString("userlogo"));
          MyApplication.getInstance().setIsSetpassword(jsonObject.getString("isSetPayPwd"));
          MyApplication.getInstance().setIdStore(jsonObject.getString("idStore"));
          MyApplication.getInstance().setBalance(jsonObject.getString("balance"));
          MyApplication.getInstance().setToKen(jsonObject.getString("toKen"));
          LogUtils.i("toKen:" + MyApplication.getInstance().getToKen());
          putSp(MyConst.isLogin, true);
          putSp(MyConst.userName, getStr(ed_user_name));
          putSp(MyConst.userPwd, getStr(ed_user_password));
          if (!TextUtils.isEmpty(MyApplication.getInstance().getToKen())) {
            messageList();
          } else {
            showToast("登录异常,请稍后重试!");
          }

        } catch (JSONException e) {
          e.printStackTrace();
        }

        break;

      case messageList:
        List<MessageBean> list = new ArrayList<MessageBean>();
        list = new Gson().fromJson(jsonString, new TypeToken<List<MessageBean>>() {}.getType());
        String spFileName = MyApplication.getInstance().getIdNumber() + "sysIdMessage";
        SharedPreferences sharedPreferences =
            getSharedPreferences(
                spFileName, Context.MODE_WORLD_READABLE + Context.MODE_WORLD_WRITEABLE);
        Iterator it;
        String str = "";
        //			list.get(0).setIdMessage(1222211111);
        // 后台不能够判断系统消息是否已读     ---把保存在SharedPreferences里面的已读的系统消息id跟消息列表接口的系统消息id想对比
        if (list.size() != 0) {

          for (int i = 0; i < list.size(); i++) {
            if ("0".equals(list.get(i).getMsgtype()) || "1".equals(list.get(i).getMsgtype())) {
              it = sharedPreferences.getStringSet("idMessage", new HashSet<String>()).iterator();
              while (it.hasNext()) {
                str = (String) it.next();
                if ((list.get(i).getIdMessage() + "").equals(str)) {
                  list.get(i).setIsRead("Y");
                }
              }
            }
          }
          MyApplication.getInstance().setMessage(list);
        }
        if (MyApplication.getInstance().getTlr_type().equals("0")) { // 0买家
          intent = new Intent(LoginActivity.this, MainActivity.class);
          startActivity(intent);
          finish();
        } else if (MyApplication.getInstance().getTlr_type().equals("1")) { // 1卖家
          intent = new Intent(LoginActivity.this, MainActivityMerchant.class);
          startActivity(intent);
          finish();
        }
        break;

      default:
        break;
    }
  }