Comments (8)
Another similar issue logged here #455. It was closed to unresponsive OP.
from dd-sdk-android.
Hi @hs-kdhillon
Thanks for reporting this issue. The official android source code explicitely mentions the menu is supposed to be NonNull
and the WindowCallbackWrapper
class in our SDK uses Kotlin to delegate it to the wrapped callback. All that considered, we are missing more information to reproduce and fix this issue.
Can you share with us the xml file used to create the menu, and any other useful information to understand how a menu can be passed as null ?
from dd-sdk-android.
chat_menu.xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
>
<item
android:id="@+id/action_phone"
android:orderInCategory="100"
android:title="Phone"
app:showAsAction="always"
android:icon="@drawable/ic_call_button"/>
<item
android:id="@+id/action_hired"
android:orderInCategory="100"
android:title="Hired"
app:showAsAction="never" />
<item
android:id="@+id/action_nothired"
android:orderInCategory="100"
android:title="Not Hired"
app:showAsAction="never" />
<item
android:id="@+id/action_accept"
android:orderInCategory="100"
android:title="Accept"
app:showAsAction="never" />
<item
android:id="@+id/action_decline"
android:orderInCategory="100"
android:title="Decline"
app:showAsAction="never" />
<item
android:id="@+id/action_archive"
android:orderInCategory="100"
android:title="Archive"
app:showAsAction="never" />
<item android:id="@+id/action_unarchive"
android:orderInCategory="100"
android:title="Unarchive"
app:showAsAction="never" />
<item
android:id="@+id/action_share"
android:orderInCategory="100"
android:title="Share"
app:showAsAction="never" />
</menu>
ChatActivity
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
menuInflater.inflate(R.menu.chat_menu, menu)
return true
}
override fun onPrepareOptionsMenu(menu: Menu?): Boolean {
menu?.findItem(R.id.action_phone)?.isVisible = viewModel.isPhoneButtonVisible().value?: false
menu?.findItem(R.id.action_accept)?.isVisible = viewModel.isAcceptDeclineButtonsVisible().value?: false
menu?.findItem(R.id.action_decline)?.isVisible = viewModel.isAcceptDeclineButtonsVisible().value?: false
menu?.findItem(R.id.action_share)?.isVisible = viewModel.isShareButtonVisible().value?: false
menu?.findItem(R.id.action_archive)?.isVisible = viewModel.isArchiveButtonVisible().value?: false
menu?.findItem(R.id.action_unarchive)?.isVisible = viewModel.isUnarchiveButtonVisible().value?: false
menu?.findItem(R.id.action_hired)?.isVisible = viewModel.isHiredButtonVisible().value?: false
menu?.findItem(R.id.action_nothired)?.isVisible = viewModel.isNotHiredButtonVisible().value?: false
return super.onPrepareOptionsMenu(menu)
}
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
when {
item!!.itemId == R.id.action_share -> viewModel.onShareClicked()
item.itemId == android.R.id.home -> onBackPressed()
item.itemId == R.id.action_accept -> viewModel.onAcceptClicked()
item.itemId == R.id.action_decline -> viewModel.onDeclineClicked()
item.itemId == R.id.action_phone -> viewModel.onPhoneClicked()
item.itemId == R.id.action_unarchive -> viewModel.onUnarchiveClicked()
item.itemId == R.id.action_hired -> viewModel.onHiredClicked()
item.itemId == R.id.action_nothired -> viewModel.onNotHiredClicked()
}
return super.onOptionsItemSelected(item)
}
Is the absence of nullability check
here causing the error override fun onOptionsItemSelected(item: MenuItem?): Boolean
? This is an old project, and not my code.
from dd-sdk-android.
Seems like onOptionItemsSelected
signature has changed to onOptionsItemSelected(item: MenuItem): Boolean
. I'll test the app with this new change, and update the issue with the findings.
from dd-sdk-android.
Changing the signatures did nothing. App still crashes when menu
is clicked on. Removing the dataDog dependency, however doesn't crash the app.
from dd-sdk-android.
Hi @hs-kdhillon, even when using your menu I couldn't reproduce this issue at first. I dug into the androidx.appcompat
source code and found a bug in the version 1.1.0
which was solved in 1.2.0
.
In your dependencies, can you make sure you're using "androidx.appcompat:appcompat:1.2.0"
or higher. This should make this crash disappear.
from dd-sdk-android.
Hi @xgouchet , can confirm the bug was related to androidx.appcompat:appcompat
as the project was using version 1.0.0
and upgrading to version 1.2.0
fixed it 👍. Can you attach the link where this issue is mentioned @xgouchet ? would be helpful for post-analysis. And thank you for your swift help as always 💯 .
Closing the issue now.
from dd-sdk-android.
Of course, here's the official issue in the appcompat
project: https://issuetracker.google.com/issues/142843126
from dd-sdk-android.
Related Issues (20)
- ANR on `Rum.enable()` HOT 7
- Rum works but logger don't send logs HOT 6
- Remove a default attribute HOT 2
- Crash generated by DrawableUtils HOT 2
- JankStatsActivityLifecycleListener.onActivityStopped - HOT 4
- setTelemetrySampleRate, explanation HOT 3
- Security vulnerability introduced with SDK v2.7.1 (okio) HOT 2
- Unable to log custom actions HOT 1
- Memory Leak : AggregatingVitalMonitor listeners are never unregistered HOT 3
- Missing DataDog events caused by UnknownError HOT 9
- Cannot implementation com.datadoghq:dd-sdk-android-logs HOT 4
- ./gradlew uploadMappingRelease crashes trying to upload mapping.txt file after release build HOT 2
- How to group views as Service? HOT 1
- Fragment views stopped getting registered HOT 1
- Crash gets assigned to wrong view HOT 1
- Fatal Exception: java.lang.IllegalStateException Recording currently in progress - missing #endRecording() call? HOT 5
- What's the preferred `DataDogInterceptor` sampling rate? HOT 1
- ValueError: Invalid traceparent version HOT 2
- Repeated network error due to "browser-intake-datadoghq.com" HOT 7
- Allow us to call `setUserInfo` without completely wiping all previously set properties set by `addUserProperties` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dd-sdk-android.