Skip to content

Instantly share code, notes, and snippets.

@myzhan
Last active August 25, 2025 16:42
Show Gist options
  • Save myzhan/ab13068463cd7f77b7f06ae561ea853a to your computer and use it in GitHub Desktop.
Save myzhan/ab13068463cd7f77b7f06ae561ea853a to your computer and use it in GitHub Desktop.
Frida android make toast
Java.scheduleOnMainThread(function() {
Toast = Java.use("android.widget.Toast");
var currentApplication = Java.use('android.app.ActivityThread').currentApplication();
var context = currentApplication.getApplicationContext();
Toast.makeText(context,"hello world", Toast.LENGTH_SHORT.value).show();
});
@0xE4s0n
Copy link

0xE4s0n commented Dec 24, 2018

It doesn't work! Why?

@pitust
Copy link

pitust commented May 22, 2020

IDK, it works for me

@yodiaditya
Copy link

@0xE4s0n @pitust This is works.

Java.perform(function () { 
    var context = Java.use('android.app.ActivityThread').currentApplication().getApplicationContext();

    Java.scheduleOnMainThread(function() {
            var toast = Java.use("android.widget.Toast");
            toast.makeText(Java.use("android.app.ActivityThread").currentApplication().getApplicationContext(), Java.use("java.lang.String").$new("This is works!"), 1).show();
    });
});

For detail information and debugging, please check https://www.yodiw.com/frida-android-make-toast-non-rooted-device/

@pitust
Copy link

pitust commented May 23, 2020

i know, that is more or less what worked for me

@fourk0
Copy link

fourk0 commented Jun 30, 2021

What about hyperlinks and stuff?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment