Java – Toast cannot be used on Samsung A5 (2016).

Toast cannot be used on Samsung A5 (2016)…. here is a solution to the problem.

Toast cannot be used on Samsung A5 (2016).

Last time I was working on the same project, I was able to use Toasts. But today, when I tried to use Toast, nothing was displayed. I tried my best to solve this problem but without success.

That’s what I’m doing [updated].

package com.azeem.abubakar.dbm;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

private Button btn_start;

    protected void onCreate(Bundle savedInstanceState) {

        btn_start = (Button) findViewById(;

Click Listener for Start Button
        btn_start.setOnClickListener(new View.OnClickListener() {
            public void onClick(View tView) {

Log.d("[INFO]", "Just Above Toast!");
                Toast.makeText(MainActivity.this, "Start button Clicked", Toast.LENGTH_SHORT).show();
                Log.d("[INFO]", "Just Below Toast!");



This is what Logcat shows when I click the Start button.

01-13 19:28:36.473 26670-26670/com.azeem.abubakar.dbm D/ViewRootImpl@ede0223[MainActivity]: ViewPostImeInputStage processPointer 0
01-13 19:28:36.474 26670-26670/com.azeem.abubakar.dbm W/System: ClassLoader referenced unknown path: /system/framework/QPerformance.jar
01-13 19:28:36.476 26670-26670/com.azeem.abubakar.dbm E/BoostFramework: BoostFramework() : Exception_1 = java.lang.ClassNotFoundException: Didn't find class " com.qualcomm.qti.Performance" on path: DexPathList[[],nativeLibraryDirectories=[/system/lib, /vendor/lib]]
01-13 19:28:36.538 26670-26670/com.azeem.abubakar.dbm D/ViewRootImpl@ede0223[MainActivity]: ViewPostImeInputStage processPointer 1
01-13 19:28:36.543 26670-26670/com.azeem.abubakar.dbm D/[INFO]: Just Above Toast!
01-13 19:28:36.552 26670-26670/com.azeem.abubakar.dbm D/TextView: setTypeface with style : 0
01-13 19:28:36.560 26670-26670/com.azeem.abubakar.dbm D/[INFO]: Just Below Toast!
01-13 19:28:36.565 26670-26670/com.azeem.abubakar.dbm D/ViewRootImpl@3da3450[Toast]: ThreadedRenderer.create() translucent=true
01-13 19:28:36.571 26670-26670/com.azeem.abubakar.dbm D/InputTransport: Input channel constructed: fd=82
01-13 19:28:36.571 26670-26670/com.azeem.abubakar.dbm D/ViewRootImpl@3da3450[Toast]: setView = android.widget.LinearLayout{5b8d649 V.E...... ...... I. 0,0-0,0} touchMode=true
01-13 19:28:36.572 26670-26670/com.azeem.abubakar.dbm D/ViewRootImpl@3da3450[Toast]: dispatchAttachedToWindow
01-13 19:28:36.593 26670-26670/com.azeem.abubakar.dbm D/ViewRootImpl@3da3450[Toast]: Relayout returned: oldFrame=[0,0][0,0] newFrame=[277,1596][802,1728] result=0x27 surface={ isValid=true -750856192} surfaceGenerationChanged=true
    mHardwareRenderer.initialize() mSurface={isValid=true -750856192} hwInitialized=true
01-13 19:28:36.594 26670-26713/com.azeem.abubakar.dbm D/mali_winsys: EGLint new_window_surface(egl_winsys_display*, void*, EGLSurface, EGLConfig, egl_winsys_surface**, egl_ color_buffer_format*, EGLBoolean) returns 0x3000,  [525x132]-format:1
01-13 19:28:36.631 26670-26670/com.azeem.abubakar.dbm D/ViewRootImpl@3da3450[Toast]: MSG_RESIZED_REPORT: frame=Rect(277, 1596 - 802, 1728) ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=1
01-13 19:28:38.565 26670-26670/com.azeem.abubakar.dbm D/ViewRootImpl@3da3450[Toast]: mHardwareRenderer.destroy()#4
01-13 19:28:38.582 26670-26670/com.azeem.abubakar.dbm D/ViewRootImpl@3da3450[Toast]: dispatchDetachedFromWindow
01-13 19:28:38.591 26670-26670/com.azeem.abubakar.dbm D/InputTransport: Input channel destroyed: fd=82

Please help me. Thank you.


Notifications are enabled for this app in Settings.

But the toast does not show. I figured it out, this may be a device related issue, correct me if I’m wrong. I say this is a device-related issue because everything worked fine the last time I used Toasts, but after installing the security update in my Samsung Galaxy device, the toast didn’t show up at all.

My phone model is Samsung A5 (2016). Please check the attached screenshots for software information.
Software Information(1/2)
Software Information(2/2)


1- Please confirm if you are trying to display the toast on the main thread?? If you don’t try this code

((MainActivity)context).runOnUiThread(new Runnable() {
    public void run() {
           Toast.makeText(MainActivity.this, "Enter Valid File Name!!", Toast.LENGTH_SHORT).show();


2- Second, try using YourActivith.this instead of getBaseContext().

3- Sometimes the toast is visible when the keyboard is on, but behind the soft keyboard try to close the keyboard first and then look.

Hope any of them help you!

Related Problems and Solutions