Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save ahmedbr/18ea7fb7e2fec8ff2e8e927abd188bdc to your computer and use it in GitHub Desktop.

Select an option

Save ahmedbr/18ea7fb7e2fec8ff2e8e927abd188bdc to your computer and use it in GitHub Desktop.
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
Toast.makeText(context, "Your text goes here ...", Toast.LENGTH_LONG).show();
}
});
@ahmedbr

ahmedbr commented Jul 25, 2018

Copy link
Copy Markdown
Author

java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
if you get such an error, then the solution is above in the gist.

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