Skip to content

Commit 2dfafe0

Browse files
authored
Merge pull request #624 from F43nd1r/toast
Fix SenderService not showing toast
2 parents c1ab1de + 186f412 commit 2dfafe0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

acra-core/src/main/java/org/acra/sender/SenderService.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
import android.app.IntentService;
1919
import android.content.Intent;
20+
import android.os.Handler;
21+
import android.os.Looper;
2022
import android.support.annotation.NonNull;
2123
import android.support.annotation.Nullable;
2224
import android.widget.Toast;
@@ -94,7 +96,12 @@ protected void onHandleIntent(@Nullable final Intent intent) {
9496
}
9597
final int toastRes = reportsSentCount > 0 ? config.resReportSendSuccessToast() : config.resReportSendFailureToast();
9698
if (toastRes != ACRAConstants.DEFAULT_RES_VALUE) {
97-
ToastSender.sendToast(this, toastRes, Toast.LENGTH_LONG);
99+
new Handler(Looper.getMainLooper()).post(new Runnable() {
100+
@Override
101+
public void run() {
102+
ToastSender.sendToast(SenderService.this, toastRes, Toast.LENGTH_LONG);
103+
}
104+
});
98105
}
99106
} catch (Exception e) {
100107
ACRA.log.e(LOG_TAG, "", e);

0 commit comments

Comments
 (0)