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)
- UploadWorker Canceled HOT 8
- RUM Resources `RumResourceMethod` enum is missing HTTP request method names HOT 3
- Inconsistencies with Error Tracking vs Firebase Crashlytics HOT 4
- Network requests tracking for 3rd parties HOT 1
- User property from future set on View Loads HOT 8
- NavigationViewTrackingEffect only logs to RUM, but doesn't let us in some way also log the navigation events as normal logs HOT 5
- TextView's compound drawables rendered smaller when enabling SessionReplay HOT 3
- IllegalArgumentException when removing OnFrameMetricsAvailableListener HOT 4
- Tracer and OkHttp: what happen when apply sampler for both of them? HOT 2
- integration issue HOT 1
- Lower than expected startup times since 2.6.0 HOT 2
- Logging: setNetworkInfoEnabled(false) doesn't seem to take effect HOT 5
- 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
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.