Android-Rich-text-Editor
Android-Rich-text-Editor copied to clipboard
How to upload image from local to firebase
i want to upload image from device to firebase storge and get url like upload from internet
Thank you, I will check it again.
@chinalwb
this line mStorageRef.child(userid+".jpg").putFile("???????????????") i try to add uris to function and it error . what is virrible that i can put image (in .putFile("???????????????"))
@Override protected String doInBackground(Uri... uris) { if (uris != null && uris.length > 0) { try { mStorageRef.child(userid+".jpg").putFile("???????????????").continueWithTask(new Continuation<UploadTask.TaskSnapshot, Task<Uri>>() { @Override public Task<Uri> then(@NonNull Task<UploadTask.TaskSnapshot> task) throws Exception { if (!task.isSuccessful()) { throw task.getException(); } return mStorageRef.child(userid+".jpg").getDownloadUrl(); } }).addOnCompleteListener(new OnCompleteListener<Uri>() { @Override public void onComplete(@NonNull Task<Uri> task) { if(task.isSuccessful()){ ImageProfileUri = task.getResult(); }else{ Log.i("Newstory",task.getException().getMessage()); } } }); } catch (Exception e) { e.printStackTrace(); }
// Returns the image url on server here
return ImageProfileUri.toString();
}
return null;
}
Sorry I don't know much about firebase storage.