解决方案 »
- 为什么我安装的SDK没有帮助文档?
- webview中打开网页,为什么一切换到输入框,获得焦点,整个页面就黑了
- 请教:如何实现麦克风的loopback?
- android的程序运行控制台报错:ActivityManager: - exec '/system/bin/sh' failed: Bad address (
- android里边怎么在程序安装的时候执行创建数据库的操作
- 请问android如何让父窗口上背景的长宽 自动适应 和它上面子窗口所占长宽的大小一样呢?
- 有啥办法能够让apk优先调用本地类,而不是系统的类不
- 文字上面白色 下面黄色怎么做出来的
- 自己开发的Android APP消耗流量过多,如何解决?
- 口袋通和微信的公众订阅号有关系吗?
- 发布一个开源的Android软件,将手机变成IP Camera的程序
- Wireshark 抓包 问题
// Save the image to a temp file and invoke the cropper
{ byte[] data;//图片数据
Uri tempUri = null;
FileOutputStream tempStream = null;
try {
File path = getFileStreamPath("crop-temp");
path.delete();
tempStream = openFileOutput("crop-temp", 0);
tempStream.write(data);
tempStream.close();
tempUri = Uri.fromFile(path);
} catch (FileNotFoundException ex) {
setResult(Activity.RESULT_CANCELED);
finish();
return;
} catch (IOException ex) {
setResult(Activity.RESULT_CANCELED)
finish();
return;
} finally {
} Bundle newExtras = new Bundle();
Intent cropIntent = new Intent("com.android.camera.action.CROP"); cropIntent.setData(tempUri);
cropIntent.putExtras(newExtras); startActivityForResult(cropIntent, CROP_MSG);
}
@Override
protected void onActivityResult(
int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case CROP_MSG: {
setResult(resultCode, data);
finish(); File path = getFileStreamPath("crop-temp");
//op
path.delete(); break;
}
}
}
.setType("image/*")
.putExtra("crop", "true")
.putExtra("aspectX", width)
.putExtra("aspectY", height)
.putExtra("outputX", width)
.putExtra("outputY", height)
.putExtra("scale", true)//黑边
.putExtra("scaleUpIfNeeded", true)//黑边
.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(f))
.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString());
大尺寸
http://www.cnblogs.com/jun-it/articles/2881826.html#commentform