我正在尝试将从手机摄像头捕获的图像上传到Firebase存储中,该图像显示在屏幕之一的图像视图中。我使用FileOutputStream引导图像缓存数据,但是该应用程序一次崩溃我打开手机上的相机
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == CAMERA_PIC_REQUEST) {
Bitmap image = (Bitmap) data.getExtras().get("data");
ImageView imageview = findViewById(R.id.ImageView01);
imageview.setImageBitmap(image);
String destFolder = getCacheDir().getAbsolutePath();
FileOutputStream out = null;
try {
out = new FileOutputStream(destFolder + "/myBitamp.png");
} catch (FileNotFoundException e)
{
e.printStackTrace();
}
Bitmap bmp = null;
bmp.compress(Bitmap.CompressFormat.PNG, 100, out);
}
}
private <storageReference> void uploadImage() {
if(getCacheDir().getAbsolutePath() != null);
storageReference ref = (storageReference) storageReference.child("images/"+ UUID.randomUUID().toString());
((StorageReference) ref).putFile(Uri.parse(getCacheDir().getAbsolutePath())).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
}
});
}
}
错误日志: 2019-05-17 14:10:41.546 29232-32694 /? E / FA:事件不能包含超过25个参数:play_pause,Bundle [{play_time = 716612,ad_master_switch = true,mnc_code = 40445,language_selection_flow = 1,orientation = portrait,action = pause,circle = ka,playing_host = manifest .prod.boltdns.net,searchflow_usertype = 3,rsflow_usertype = 0,signal_strength_info = SignalStrength:99 0 -120 -160 -120 -160 -1 18 -104 -13 38 2147483647 0 2147483647 99 255 2147483647 gsm | lte use_rsrp_and_rssnr [for-lte_128 ,-115,-110,-105,-97] [-115,-105,-95,-85],操作员= AIRTEL,landing_page_atv_plus = 0,比特率= 0,source_name = airtel_tv_premium,network_type = 4G,firebase_screen_class(_sc )= AirtelmainActivity,firebase_screen_id(_si)=-4997872789649524094,content_id = HOOQ_EPISODE_111281,landing_page_atv = 0,content_detail_page_ad_unit = true,content_name =母体结论,content_type = VOD,pre_roll_ad_unit = true,streamingHOtype = teles, play_session_id = RsglFIqEL1NVFdvh40-1558082341222,app_type = MOBILITY,搜索结果_usertype = 0,is_drm_content = true,signal_strength_level = 4,license_roundtrip_time = 856}]
我希望将捕获的图像上传到我的Firebase存储中,但是一旦打开相机,应用就会崩溃。