private String setCuttedPicturePath() { // oringlePicturePath 不对 cuttedPicturePath = intent.getStringExtra(INTENT_CUTTED_PICTURE_PATH); if (StringUtil.isFilePath(cuttedPicturePath) == false) { cuttedPicturePath = DataKeeper.fileRootPath + DataKeeper.imagePath; } cuttedPictureName = intent.getStringExtra(INTENT_CUTTED_PICTURE_NAME); if (StringUtil.isFilePath(cuttedPictureName) == false) { cuttedPictureName = "photo" + System.currentTimeMillis(); } return cuttedPicturePath; }
/** * 显示图片 * * @param path */ private void setPicture(String path) { if (StringUtil.isFilePath(path) == false) { Log.e( TAG, "setPicture StringUtil.isFilePath(path) == false >> showShortToast(找不到图片);return;"); showShortToast("找不到图片"); return; } this.picturePath = path; svDemoMain.smoothScrollTo(0, 0); try { ivDemoMainHead.setImageDrawable(new BitmapDrawable(getResources(), picturePath)); } catch (Exception e) { showShortToast("设置图片失败了,再试一次吧^_^"); } }
/** * 裁剪图片 * * @param path */ private void cutPicture(String path) { if (StringUtil.isFilePath(path) == false) { Log.e( TAG, "cutPicture StringUtil.isFilePath(path) == false >> showShortToast(找不到图片);return;"); showShortToast("找不到图片"); return; } this.picturePath = path; intent = new Intent(context, CutPictureActivity.class); intent.putExtra(CutPictureActivity.INTENT_ORIGINAL_PICTURE_PATH, picturePath); intent.putExtra( CutPictureActivity.INTENT_CUTTED_PICTURE_PATH, DataKeeper.fileRootPath + DataKeeper.imagePath); intent.putExtra( CutPictureActivity.INTENT_CUTTED_PICTURE_NAME, "photo" + System.currentTimeMillis()); intent.putExtra(CutPictureActivity.INTENT_CUT_HEIGHT, 200); toActivity(intent, REQUEST_TO_CUT_PICTURE); }