0

I am trying to upload the image on firebase storage and i am using the startActivityForResult with the intent and the request code but looks like it is deprecated. Is there any alternative for it. Code for reference

 public void pickImage(View v)
{
    Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
   startActivityForResult(intent, 101);

}

@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
      if (requestCode==101)
        if (resultCode == RESULT_OK) {
            localFileUri = data.getData();
            ivProfile.setImageURI(localFileUri);
        }
    }
  • Picking an image is the [example right from the documentation](https://developer.android.com/training/basics/intents/result). Did you read the documentation? – ianhanniballake Mar 19 '22 at 20:52
  • If you understand Kotlin, I think that this [article](https://medium.com/firebase-tips-tricks/how-to-create-an-android-app-using-multiple-firebase-products-in-kotlin-16aade81ffec) will help. – Alex Mamo Mar 20 '22 at 09:29

0 Answers0