I cannot figure out how to assign onGifSelected while using Java. https://developers.giphy.com/docs/sdk#android I've created a button which shows the Giphy dialog correctly, but nothing happens when I choose a gif (I have to implement the function).
gifBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
GiphyDialogFragment.Companion.newInstance(gphSettings).show(getSupportFragmentManager(), "this");
gifSelectionListener.onGifSelected(media);
gifSelectionListener.onDismissed();
}
});
I get the following error, even though I have declared "media" in the beginning of the class.
java.lang.NullPointerException: Attempt to invoke interface method 'void com.giphy.sdk.ui.views.GiphyDialogFragment$GifSelectionListener.onGifSelected(com.giphy.sdk.core.models.Media)' on a null object reference
at com.example.alexevangelou.bumpr.MessageActivity$5.onClick(MessageActivity.java:196)