Make toast work from a background thread
ClosedPublic

Authored by eduisters on Dec 7 2018, 11:00 AM.

Details

Summary

When receiving a text share an attempt is made to show a toast but that results
in an exception because the issuing thread is not running a looper.

Test Plan

Without this patch applied Share a text with an android device using the plasmoid
Result: No toast is displayed and in logcat you will get a:

java.lang.RuntimeException: Can't toast on a thread that has not called Looper.prepare() exception

With this patch applied again Share a text an android device using the plasmoid
Result: The toast is actually displayed even when the activity is not in the foreground

Diff Detail

Repository
R225 KDE Connect - Android application
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
eduisters created this revision.Dec 7 2018, 11:00 AM
Restricted Application added a project: KDE Connect. · View Herald TranscriptDec 7 2018, 11:00 AM
Restricted Application added a subscriber: kdeconnect. · View Herald Transcript
eduisters requested review of this revision.Dec 7 2018, 11:00 AM
eduisters retitled this revision from Make toast work from a background threat to Make toast work from a background thread.Dec 7 2018, 11:07 AM
eduisters edited the summary of this revision. (Show Details)
albertvaka accepted this revision.Dec 7 2018, 12:24 PM
This revision is now accepted and ready to land.Dec 7 2018, 12:24 PM
This revision was automatically updated to reflect the committed changes.