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

java.lang.ClassCastException: android.text.SpannableString cannot be cast to java.lang.String #1357

Closed
khjde1207 opened this issue Oct 28, 2021 · 0 comments · Fixed by #1360

Comments

@khjde1207
Copy link

Describe the bug

To Reproduce

  1. run flutter_local_notifications/example/lib/main.dart
  2. edit main.dart 1168 line "_showBigTextNotification()"
const BigTextStyleInformation bigTextStyleInformation =
        BigTextStyleInformation(
      'Lorem <i>ipsum dolor sit</i> .....',
      htmlFormatBigText: true,
      contentTitle: 'overridden <b>big</b> content title',
      htmlFormatContentTitle: true,
      htmlFormatContent: true, //<--------------- add this 
      htmlFormatTitle: true,
      summaryText: 'summary <i>text</i>',
      htmlFormatSummaryText: true,
    );
  1. click 'Show big text notification' button
  2. click 'Get active notifications'
  3. See error

Expected behavior


W/Bundle  (19395): Key android.title expected String but value was a android.text.SpannableString.  The default value <null> was returned.
W/Bundle  (19395): Attempt to cast generated internal exception:
W/Bundle  (19395): java.lang.ClassCastException: android.text.SpannableString cannot be cast to java.lang.String
W/Bundle  (19395): 	at android.os.BaseBundle.getString(BaseBundle.java:1170)
W/Bundle  (19395): 	at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.getActiveNotifications(FlutterLocalNotificationsPlugin.java:1347)
W/Bundle  (19395): 	at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.onMethodCall(FlutterLocalNotificationsPlugin.java:1063)
W/Bundle  (19395): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
W/Bundle  (19395): 	at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:84)
W/Bundle  (19395): 	at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:865)
W/Bundle  (19395): 	at android.os.MessageQueue.nativePollOnce(Native Method)
W/Bundle  (19395): 	at android.os.MessageQueue.next(MessageQueue.java:336)
W/Bundle  (19395): 	at android.os.Looper.loop(Looper.java:174)
W/Bundle  (19395): 	at android.app.ActivityThread.main(ActivityThread.java:7356)
W/Bundle  (19395): 	at java.lang.reflect.Method.invoke(Native Method)
W/Bundle  (19395): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
W/Bundle  (19395): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:925)
W/Bundle  (19395): Key android.text expected String but value was a android.text.SpannableString.  The default value <null> was returned.
W/Bundle  (19395): Attempt to cast generated internal exception:
W/Bundle  (19395): java.lang.ClassCastException: android.text.SpannableString cannot be cast to java.lang.String
W/Bundle  (19395): 	at android.os.BaseBundle.getString(BaseBundle.java:1170)
W/Bundle  (19395): 	at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.getActiveNotifications(FlutterLocalNotificationsPlugin.java:1348)
W/Bundle  (19395): 	at com.dexterous.flutterlocalnotifications.FlutterLocalNotificationsPlugin.onMethodCall(FlutterLocalNotificationsPlugin.java:1063)
W/Bundle  (19395): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
W/Bundle  (19395): 	at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:84)
W/Bundle  (19395): 	at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:865)
W/Bundle  (19395): 	at android.os.MessageQueue.nativePollOnce(Native Method)
W/Bundle  (19395): 	at android.os.MessageQueue.next(MessageQueue.java:336)
W/Bundle  (19395): 	at android.os.Looper.loop(Looper.java:174)
W/Bundle  (19395): 	at android.app.ActivityThread.main(ActivityThread.java:7356)
W/Bundle  (19395): 	at java.lang.reflect.Method.invoke(Native Method)
W/Bundle  (19395): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
W/Bundle  (19395): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:925)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant