Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R.id.chat_container NOT FOUND! #102

Open
UmerTaptap opened this issue Oct 3, 2024 · 1 comment
Open

R.id.chat_container NOT FOUND! #102

UmerTaptap opened this issue Oct 3, 2024 · 1 comment

Comments

@UmerTaptap
Copy link

ChatController.Builder(context).build(account, object : ChatLoadedListener { override fun onComplete(result: ChatLoadResponse) { result.error?.let { // report Chat loading failed } ?: let { // add result.fragment to your activity. supportFragmentManager.beginTransaction().replace(R.id.chat_container, result.fragment, tag).commit() } } })

I just copied this code snippet, getting error in " supportFragmentManager.beginTransaction().replace(R.id.chat_container, result.fragment, tag).commit()" line, saying "Unresolved reference: chat_container". What i should do?

@mobichel
Copy link
Collaborator

mobichel commented Oct 8, 2024

Dear @UmerTaptap ,

Thank you for reaching out about the error you're encountering with the ChatController code snippet.

The error "Unresolved reference: chat_container" typically occurs when the layout resource ID R.id.chat_container is not defined in your layout XML file.

To fix this, you need to ensure that you have a container view in your layout with the ID "chat_container". Here are the steps to resolve this:

  • Open your layout XML file (e.g., activity_main.xml or whatever layout file you're using for this activity).
  • Add a container view (like a FrameLayout) to host your chat fragment. For example:
<FrameLayout
    android:id="@+id/chat_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />
  • Make sure this container is placed appropriately within your layout hierarchy.
  • After adding the container, rebuild your project to ensure it's working correctly.

Don't hesitate to use our forums for your future questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants