onActivityResult不显示图像

时间:2019-05-08 06:53:48

标签: android android-bitmap

因此,我想拍照并在屏幕上显示。我可以按下按钮并拍照,但是它并未显示在constructor(private yourService: EmployeeService) { } ngOnInit() { this.yourService.getEmployee(id).subscribe(data=>{ this.hideExpression = data.isEmployee === true; }); } @Injectable() export class EmployeeService { constructor(private http: HttpClient){ } getEmployee(id){ return this.http.get(`/api/employee?id=${id}`); } } 上。我无法通过搜索ImageView找到解决方案。

我现在所拥有的:

onActivityresult

2 个答案:

答案 0 :(得分:6)

使用此:

Bitmap bitmap = (Bitmap)data.getExtras().get("data");

代替:

Bitmap bitmap = (Bitmap)data.getExtras().get("Data");

答案 1 :(得分:0)

尝试

if (requestCode == 0 && resultCode == RESULT_OK )
    {
        Uri imgUri = data.getData();
        try {
            Bitmap bm = MediaStore.Images.Media.getBitmap(getContentResolver(), imgUri);
            imageView.setImageBitmap(bm);}}
相关问题