Пример #1
0
 public static Bitmap getVerify(Context context) {
   String url = "http://verify.xunlei.com/image?cachetime=" + System.currentTimeMillis();
   System.out.println("获取验证码===>>>" + url);
   HttpResult result = HttpClientHelper.get(url);
   byte[] data = null;
   if (result != null && result.getStatuCode() == HttpStatus.SC_OK) {
     Cookie cookie = result.getCookie("VERIFY_KEY");
     data = result.getResponse();
     if (cookie == null) {
       return null;
     }
     String value = cookie.getValue();
     System.out.println(value);
     saveUserKey(context, value);
   }
   Bitmap bm = null;
   if (data != null) {
     ByteArrayInputStream is = new ByteArrayInputStream(data);
     bm = BitmapFactory.decodeStream(is);
   }
   return bm;
 }