老师,为什么我的这个jsonObject没有打印出来?
FaceppDetect:
public static void detect(final Bitmap bm ,final CallBack callback){ new Thread(new Runnable() { @Override public void run() { try { //创建请求 HttpRequests requests=new HttpRequests(Constant.KEY, Constant.SECRET, true, true); Bitmap bmSmall=Bitmap.createBitmap(bm,0,0,bm.getWidth(),bm.getHeight()); ByteArrayOutputStream stream=new ByteArrayOutputStream(); bmSmall.compress(Bitmap.CompressFormat.JPEG, 100, stream); byte[] arrays=stream.toByteArray(); PostParameters parameters=new PostParameters(); parameters.setImg(arrays); JSONObject jsonObject=requests.detectionDetect(parameters); // Log.e("Tag", jsonObject.toString()); if(callback!=null){ callback.success(jsonObject); } } catch (FaceppParseException e) { e.printStackTrace(); if(callback!=null){ callback.error(e); } } } }).start(); }
MainActivity:
@Override public void onClick(View v) { switch (v.getId()) { case R.id.getImage: Intent intent = new Intent(Intent.ACTION_PICK); intent.setType("image/*"); startActivityForResult(intent, PICK_CODE); break; case R.id.detect: FaceppDetect.detect(mPhotoImage, new CallBack() { @Override public void success(JSONObject result) { } @Override public void error(FaceppParseException exception) { } }); break; } }