MultiContactPicker icon indicating copy to clipboard operation
MultiContactPicker copied to clipboard

Didn't Work in fragment

Open pareekrohit opened this issue 6 years ago • 5 comments

onActivityResult() doesn't get called in fragment after selecting contacts.

pareekrohit avatar Dec 05 '18 09:12 pareekrohit

@pareekrohit did you find any solutions. I am getting the same issue.

deepakkumardk avatar Feb 25 '19 08:02 deepakkumardk

Any solutions for fragment.

royviral avatar Jul 03 '19 11:07 royviral

fragment issue is still there. So you have to get the data from the activity's onActivityResult. It is triggering there. Open the picker in fragment and the get the data on activity where you have implemented fragment and then pass the data to fragment.

sum20156 avatar Jun 10 '20 17:06 sum20156

This might resolve the issue. In your parent activity

// Kotlin
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        super.onActivityResult(requestCode, resultCode, data)
        for (fragment in supportFragmentManager.fragments) {
            fragment.onActivityResult(requestCode, resultCode, data)
        }
    }

ispam avatar Feb 07 '21 15:02 ispam

This might resolve the issue. In your parent activity

// Kotlin
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        super.onActivityResult(requestCode, resultCode, data)
        for (fragment in supportFragmentManager.fragments) {
            fragment.onActivityResult(requestCode, resultCode, data)
        }
    }

Fragment.onActivityResult() is deprecated as of 2022. There is a replacement for onActivityResult() but it depends on Dialog class, which this doesn't extend.

gnongsiej avatar Jan 27 '22 12:01 gnongsiej