Beispiel #1
0
  @Override
  protected String doInBackground(String... params) {

    String host = "ngalocation.appspot.com";
    String ret = null;
    for (int i = 0; i < ips.length; ++i) {
      StringBuilder sb = new StringBuilder("https://");
      try {
        sb.append(ips[i])
            .append("/test?nick_name=")
            .append(URLEncoder.encode(name, "utf-8"))
            .append("&user_id=")
            .append(uid)
            .append("&longitude=")
            .append(longitude)
            .append("&latitude=")
            .append(latitude);
      } catch (UnsupportedEncodingException e) {
        // TODO Auto-generated catch block
        return null;
      }
      ret = HttpUtil.getHtml(sb.toString(), "", host, 8000);
      if (!StringUtil.isEmpty(ret)) break;
      else {
        this.publishProgress(i + 1, ips.length);
      }
    }

    return ret;
  }
 @Override
 protected MeiziTopicMData doInBackground(String... params) {
   String url = params[0];
   String htmlString;
   if (!StringUtil.isEmpty(PhoneConfiguration.getInstance().getDb_Cookie())) {
     htmlString = HttpUtil.getHtmlForDbmeizi(url, PhoneConfiguration.getInstance().getDb_Cookie());
   } else {
     htmlString = HttpUtil.getHtmlForDbmeizi(url, PhoneConfiguration.getInstance().getDb_Cookie());
   }
   if (!StringUtil.isEmpty(htmlString)) {
     MeiziTopicMData resulTopicM = null;
     if (url.toLowerCase(Locale.US).indexOf("baozhao") > 0) {
       BaozhaoTopicDecoder mDecoder = new BaozhaoTopicDecoder();
       resulTopicM = mDecoder.decode(htmlString);
     } else {
       TopicDecoder mDecoder = new TopicDecoder();
       resulTopicM = mDecoder.decode(htmlString);
     }
     return resulTopicM;
   } else {
     return null;
   }
 }