vanniktech / Emoji

A library to add Emoji support to your Android / iOS / JVM Application
Apache License 2.0
1.53k stars 292 forks source link

EmojiView(without edittext) cannot be added into another view #1012

Closed Superpengun closed 1 year ago

Superpengun commented 1 year ago

1.8 version

I try to add the emojiview to another view running as a dialog on a service(not activity),without a edittext; Referring to the example"EmojisActivity",put "com.vanniktech.emoji.EmojiView" to xml,and use "setUp(view,null,null,null)"to init the view; If the params "view" is the emojiview's praent view(my custom view),the application will repeat"at android.view.View.inflate(View.java:26707)" image
It is same if i put the dialog's decorView as the param; And if i inflate a Layout and set it as the dialog's contentview,and then code the emojiview like "mEmojiView = currentInputView?.findViewById(R.id.emoji_view)" the currentinputview is the layout; the application will crash at "EmojiView :findViewById(R.id.emojiViewPager)" it report a nullpointer crash image
The rootview which emojiview need some potential condition?

vanniktech commented 1 year ago

You need to call setUp of EmojiView

Superpengun commented 1 year ago

You need to call setUp of EmojiView

the second pic is the setUp method of EmojiView,crash occured in“findViewById”

vanniktech commented 1 year ago

You're doing something wrong then. I'm using EmojiView within a dialog, can you reproduce this in the sample app?

Superpengun commented 1 year ago

You're doing something wrong then. I'm using EmojiView within a dialog, can you reproduce this in the sample app?

in your demo,it's ok when init it in a dialogfragment;but it not work well in a dialog in a service and the it's context is using the displaycontext(for example ,Display 1 use Context.createDisplayContext(1) as context)

vanniktech commented 1 year ago

Probably a limitation of the display context then, we need a proper context with a proper window.