小编Jac*_*les的帖子

MediaStore.EXTRA_OUTPUT呈现数据为空,其他方式保存照片?

谷歌提供这个多功能的代码,通过意图拍摄照片:

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    // create Intent to take a picture and return control to the calling application
    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

    fileUri = getOutputMediaFileUri(MEDIA_TYPE_IMAGE); // create a file to save the image
    intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); // set the image file name

    // start the image capture Intent
    startActivityForResult(intent, CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);
}
Run Code Online (Sandbox Code Playgroud)

问题在于,如果你像我一样想要将照片作为附加照片传递,那么EXTRA_OUTPUT看似使用照片数据并使后续操作认为意图数据为空.

看来这是Android的一个大错误.

我正在尝试拍摄照片,然后在新视图中将其显示为缩略图.我想将它保存为用户图库中的全尺寸图像.有没有人知道如何指定图像位置而不使用EXTRA_OUTPUT

这是我目前的情况:

public void takePhoto(View view) {
    Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

    fileUri = getOutputMediaFileUri(MEDIA_TYPE_IMAGE);
//  takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, …
Run Code Online (Sandbox Code Playgroud)

java camera android android-intent

16
推荐指数
1
解决办法
4万
查看次数

D3 - 获取当前时间并减去2小时

我正在尝试在d3中创建两个变量,一个是当前小时和分钟(00:00格式),另一个是当前时间,小时值减去2.因此,例如:当前时间是15:38,另一个变量将被计算为13:38.

这是我当前获取当前时间的代码(在coffeescript中):

formatTime = d3.time.format("%H:%M")
currentTime = (d) -> formatTime(new Date())
Run Code Online (Sandbox Code Playgroud)

提前致谢!

javascript coffeescript d3.js

10
推荐指数
1
解决办法
8702
查看次数