我的第一个问题!我有一段代码的问题,使用额外的输出选项启动摄像头意图,然后在活动结果尝试调整该图像的大小.发生的事情是在回调的resize函数中抛出一个nullpointer异常.
原始的大图片仍保存在文件系统中,因为我可以从文件系统访问它.
最初的相机jpeg尺寸为2560x1920,使用的手机是google nexus.
我不明白为什么调整大小不起作用,任何人都有任何见解?
这是一些代码:
takePicture函数也创建了虚拟文件:
public boolean takePicture( ) {
Log.e(TAG, "takePicture interface function");
String FileUri = Environment.getExternalStorageDirectory() + "/samples/";
File file = new File(FileUri,"picture"+ pictureNumber +".jpg");
try {
file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
Uri outputFileUri = Uri.fromFile(file);
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri);
startActivityForResult(cameraIntent, CAMERA_REQUEST);
Log.e(TAG, "intent started");
return true;
}
Run Code Online (Sandbox Code Playgroud)
on活动结果回调函数:
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// handle the camera request returns and handle back button in camera. …Run Code Online (Sandbox Code Playgroud) 有谁知道如何在HTML页面中打印.hbs/.handlebars模板?我到处寻找,但我无法弄清楚如何将.hbs文件放在一个目录中,然后在我的index.html中打印它们.很抱歉这个问题,但我是车把的新用户.提前致谢!