chat-sdk / chat-sdk-android

Chat SDK Android - Open Source Mobile Messenger

Home Page:https://chatsdk.co

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Help regarding overriding of MainActivity

BismeetSingh opened this issue · comments

I want to make a request to the firebase database when the main activity loads. So, I created a custommainactivity and passed it to the setMainActivity. But the issue is MainActivity is an abstract class and so I also need to implement the functions / make my custom main activity abstract which I cant otherwise it cant be instantiated.

@BismeetSingh you can either extend the MainAppBarActivity which isn't abstract or you will have to implement the abstract methods.

 Caused by: java.lang.IllegalStateException: Required view 'toolbar' with ID 2131362506 for field 'toolbar' was not found. If this view is optional add '@Nullable' (fields) or '@Optional' (methods) annotation.

This is what I get on extending MainAppBarActivity.
So it basically means ChatSdk doesn't have a way to implement a custom MainActivity?

It probably means that your layout xml file doesn't match - i.e. you don't have an element with the ID toolbar.

        <include layout="@layout/app_bar_default" />

This line