Skip to content

Conversation

@azizutku
Copy link
Contributor

@azizutku azizutku commented Jan 5, 2026

Problem

On Android 9 (API 28), dialog widgets like DialogTitle crash with UnsupportedOperationException when resolving theme attribute references (e.g., android:textColorLink). This happens because createDialogWidgetView() uses createWrappedContext() which doesn't include the dialog's theme.

Fixes #35

Solution

Pass the inflationContext to createDialogWidgetView() and create a ContextThemeWrapper that combines ViewPump's wrapped context with the dialog's theme:

val themedSafeContext = ContextThemeWrapper(
    createWrappedContext(),
    inflationContext.theme
)

This preserves ViewPump's resource interception while enabling proper theme attribute resolution.

Changes

  • Added inflationContext: Context parameter to createDialogWidgetView()
  • Created themedSafeContext using ContextThemeWrapper
  • Updated dialog widgets to use themedSafeContext

@B3nedikt B3nedikt merged commit 7fda116 into B3nedikt:master Jan 7, 2026
1 check passed
@azizutku azizutku deleted the fix/android9-dialog-theme-crash branch January 8, 2026 05:28
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

Successfully merging this pull request may close these issues.

Crash on Android 9 (API 28): Failed to resolve textColorLink attribute when inflating DialogTitle

2 participants