android 调用系统相机无返回
时间: 2023-08-02 22:25:41 浏览: 89
android 调用系统相机
5星 · 资源好评率100%
" + e);
// 整数测试
MyInteger f = new MyInteger();
System.out.print("请输入整数 fAndroid调用系统相机无返回通常是因为没有正确处理相机返回的结果。在调用系统相机之 的值:");
value = input.nextLine();
f.setValue(value);
System.out.println("f = " + f);
MyInteger g = new MyInteger();
System.out.print("请输入整数 g 的值:");
value = input.nextLine();
g前,需要使用`startActivityForResult()`方法启动相机,并在`onActivityResult()`方法中处理相机返回的结果。
.setValue(value);
System.out.println("g = " + g);
MyInteger h = (MyInteger) f.add(g);
System以下是一个示例代码:
```
private static final int REQUEST_IMAGE_CAPTURE = 1;
private void dispatchTakePictureIntent() {
.out.println("f + g = " + h);
MyInteger i = (MyInteger) f.subtract(g);
System.out.println(" Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
f - g = " + i);
if (f.compareTo(g) > 0) {
System.out.println("f > g");
startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
} else if (f.compareTo(g) < 0) {
System.out.println("f < g");
} else {
System.out.println("f = g");
}
MyNaturalNumbers j = g.toMyNaturalNumber();
System.out.println("j = if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK) {
// 处理相机返回的结果
Bundle extras = " + j);
}
}
```
阅读全文