0

I am trying to save an image to firebase storage for that I have added a button when I click on it and select the image nothing happens, any help how to achieve it, the code which I wrote is below for now just logging but it is not working and it is saying onActivityResult is deprecated

Fragment.kt

// this is inside onCreateView
btn_image.setOnClickListener(View.OnClickListener {
            val intent = Intent(Intent.ACTION_GET_CONTENT)
            intent.type = "image/*"
            startActivity(intent)
        })
// end onCreateView

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        super.onActivityResult(requestCode, resultCode, data) // 'onActivityResult(Int, Int, Intent?): Unit' is deprecated. Deprecated in Java
        if(requestCode == 0 && resultCode == Activity.RESULT_OK && data != null) {
            Log.e("AAA", "selected")
        }
    }

ParentActivity

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        super.onActivityResult(requestCode, resultCode, data) // this is depercated
    }
Nadish
  • 49
  • 6

0 Answers0