crisp-im / crisp-sdk-android

:package: Crisp Android SDK, add a chat in any Android app and communicate with your users.
https://docs.crisp.chat/guides/chatbox-sdks/android-sdk/
Other
55 stars 17 forks source link

Error in AppCompat fragments #17

Closed ArtyomVoronov closed 6 years ago

ArtyomVoronov commented 6 years ago

It's impossible to use CrispFragment inside AppCompat fragments. Returning to a fragment with CrispFragment inside I have "Duplicate ID, tag null, or parent id with another fragment" error. Few workarounds exist and all of them require CrispFragment inheritance from android.support.v4.app.Fragment. For example, https://stackoverflow.com/a/19815266/4589148

Do you plan to implement CrispFragment for AppCompat?

baptistejamin commented 6 years ago

Our example is using AppCompat, look at https://raw.githubusercontent.com/crisp-im/crisp-sdk-android/master/example/src/main/java/crisp/im/example/MainActivity.java

I think it's something else.

ArtyomVoronov commented 6 years ago

It works perfectly if you place CrispFragment inside activity. To reproduce it try to use CrispFragment inside fragment inside AppCompatActivity. I'll show sample code tomorrow.

baptistejamin commented 6 years ago

The example just above is using an AppCompatActivity

ArtyomVoronov commented 6 years ago

Yes, and your example works correctly. The problem reproduces using CrispFragment inside nested fragments inside an AppCompatActivity.

baptistejamin commented 6 years ago

You can still inflate manually Note:

You cannot inflate a layout into a fragment when that layout includes a . Nested fragments are only supported when added to a fragment dynamically.

aazam-nouri commented 4 years ago

And how to add that to a fragment dynamically?