Я пытаюсь загрузить изображение, снятое с камеры телефона, и которое отображается в виде изображения на одном из экранов, в хранилище 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, ориентация = портрет, action = пауза, circle = ka, Play_host = манифест.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 |, -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.play_session_id = RsglFIqEL1NVFdvh40-1558082341222, app_type = MOBILITY, searchresults_usertype = 0, is_drm_content = true, signal_strength_level = 4, license_roundtrip_time = 856}]
Я ожидаю загрузки изображения, снятого в мое хранилище Firebase, но как только я открываю камеру, приложение вылетает.