@Override public void onActivityResult(final int requestCode, int resultCode, final Intent data) { if (resultCode != Activity.RESULT_OK) return; switch (requestCode) { case ImageUtils.REQUEST_CODE_GETIMAGE_BYCAMERA: { if (theLarge != null && !theLarge.equals("")) { Intent intent = new Intent(TeacherIdenSetAcitvity.this, ImageActivity.class); intent.putExtra(ImageActivity.PATH, theLarge); startActivityForResult(intent, photo); return; } else { ShowToast.showTips(TeacherIdenSetAcitvity.this, "不能保存图片"); } } break; case ImageUtils.REQUEST_CODE_GETIMAGE_BYSDCARD: { if (data != null) { // savePath = Environment.getExternalStorageDirectory() // .getAbsolutePath() + DownloadUtil.IMAGE_PATH; // File savedir = new File(savePath); // if (!savedir.exists()) { // savedir.mkdirs(); // } Uri thisUri = data.getData(); String filepath = ImageUtils.getPath(TeacherIdenSetAcitvity.this, thisUri); if (filepath == null) { return; } Intent intent = new Intent(TeacherIdenSetAcitvity.this, ImageActivity.class); intent.putExtra(ImageActivity.PATH, filepath); startActivityForResult(intent, photo); } } break; case photo: { String Path = null; Bundle extras = data.getExtras(); if (extras != null) { Path = extras.getString(ImageActivity.PATH); photocorp(Path); } } break; default: break; } super.onActivityResult(requestCode, resultCode, data); }
/** 选择图片 以及上传 2015-3-6 @author lzx */ void setfile() { if (!filepath.equals("") && !isupload) { if (ALLUtil.isNetworkConnected(TeacherIdenSetAcitvity.this)) { Message msg = handler.obtainMessage(); msg.what = -1; msg.arg1 = 0; handler.sendMessage(msg); UpdateFile updateFile = new UpdateFile(); ServiceLoader.getInstance().submit(updateFile); } else { ShowToast.showTips(TeacherIdenSetAcitvity.this, "网络不可用"); } } else { getphoto(); } }