The usual Toast, but with steroids ๐Ÿ’ช

Overview

ko-fi

Toasty

API Android Arsenal

The usual Toast, but with steroids.

Prerequisites

Add this in your root build.gradle file (not your module build.gradle file):

allprojects {
	repositories {
		...
		maven { url "https://jitpack.io" }
	}
}

Dependency

Add this to your module's build.gradle file (make sure the version matches the JitPack badge above):

dependencies {
	...
	implementation 'com.github.GrenderG:Toasty:1.5.0'
}

Configuration

This step is optional, but if you want you can configure some Toasty parameters. Place this anywhere in your app:

Toasty.Config.getInstance()
    .tintIcon(boolean tintIcon) // optional (apply textColor also to the icon)
    .setToastTypeface(@NonNull Typeface typeface) // optional
    .setTextSize(int sizeInSp) // optional
    .allowQueue(boolean allowQueue) // optional (prevents several Toastys from queuing)
    .apply(); // required

You can reset the configuration by using reset() method:

Toasty.Config.reset();

Usage

Each method always returns a Toast object, so you can customize the Toast much more. DON'T FORGET THE show() METHOD!

To display an error Toast:

Toasty.error(yourContext, "This is an error toast.", Toast.LENGTH_SHORT, true).show();

To display a success Toast:

Toasty.success(yourContext, "Success!", Toast.LENGTH_SHORT, true).show();

To display an info Toast:

Toasty.info(yourContext, "Here is some info for you.", Toast.LENGTH_SHORT, true).show();

To display a warning Toast:

Toasty.warning(yourContext, "Beware of the dog.", Toast.LENGTH_SHORT, true).show();

To display the usual Toast:

Toasty.normal(yourContext, "Normal toast w/o icon").show();

To display the usual Toast with icon:

Toasty.normal(yourContext, "Normal toast w/ icon", yourIconDrawable).show();

You can also create your custom Toasts with the custom() method:

Toasty.custom(yourContext, "I'm a custom Toast", yourIconDrawable, tintColor, duration, withIcon, 
shouldTint).show();

Extra

You can pass formatted text to Toasty!

There are variants of each method, feel free to explore this library.

Screenshots

Please click the image below to enlarge.

Third Party Bindings

React Native

You may now use this library with React Native via this module.

Apps using Toasty

Want to be here? Open an issue or make a pull request.

ColorHub - Color Palette
Daily โ€“ News flipped around
Oz! Comic Reader
Impactor Unroot
Fusemounter
BlueWords
Photo Map - Photo and Video Gallery
Maki for Facebook & Twitter
ModPE IDE
Rocket Notes
OpenHub for GitHub
openHAB
Saarang
Kad ce mi bus - red voznje
Hide Files
LogViewer for openHAB
Comments
  • Fatal Exception: ResourcesNotFoundException

    Fatal Exception: ResourcesNotFoundException

    Crash when app trying init Toasty.warning ToastyUtils.getDrawable(context, drawable.ic_error_outline_white_48dp)

    I never see this issue before but after building as App bundle it's happens.

    screen shot 2018-09-30 at 13 01 02 pm bug help wanted 
    opened by DimaDDM 11
  • [Refactoring] Exude color variables to resources

    [Refactoring] Exude color variables to resources

    I think it will be better to move color variables into resource file.

    1. It will reduce code duplication

    2. it will increase readability, since I thought through code that warning and error colors are constants, also actualy they not

    3. It will give the user more flexibility to config toast. They will able to rewrite your color resources in their own complex resources files. Suppose, we have aaplication, that for different regions use different color schemes. With code-config-aproach it will request for library user more effort to adjust colors by config changes, that if colors were in resource file

    opened by programmerr47 11
  • after adding your library in project these errors come up

    after adding your library in project these errors come up

    build error

    Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar]
    C:\Users\tariq\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.0.2.aar\d8468f24b31c24ee8d29575dc26584f6\res\values-v26\values-v26.xml
    Error:(9, 5) error: resource android:attr/colorError not found.
    Error:(13, 5) error: resource android:attr/colorError not found.
    Error:(17, 5) error: style attribute 'android:attr/keyboardNavigationCluster' not found.
    C:\Users\tariq\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.0.2.aar\d8468f24b31c24ee8d29575dc26584f6\res\values\values.xml
    Error:(252, 5) error: resource android:attr/fontStyle not found.
    Error:(252, 5) error: resource android:attr/font not found.
    Error:(252, 5) error: resource android:attr/fontWeight not found.
    C:\Users\tariq\Desktop\adnan laravel android pharamacy\materiallogindemo-master\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v26\values-v26.xml
    Error:(7) resource android:attr/colorError not found.
    Error:(11) resource android:attr/colorError not found.
    Error:(15) style attribute 'android:attr/keyboardNavigationCluster' not found.
    C:\Users\tariq\Desktop\adnan laravel android pharamacy\materiallogindemo-master\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml
    Error:(438) resource android:attr/fontStyle not found.
    Error:(438) resource android:attr/font not found.
    Error:(438) resource android:attr/fontWeight not found.
    Error:failed linking references.
    Error:java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
    Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
    Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
    Error:Execution failed for task ':app:processDebugResources'.
    > Failed to execute aapt
    Information:BUILD FAILED in 13s
    Information:17 errors
    Information:0 warnings
    Information:See complete output in console
    
    invalid 
    opened by tjnapster555 10
  • Toast.LENGTH_LONG does not work on Android 7.1 in onCreate()

    Toast.LENGTH_LONG does not work on Android 7.1 in onCreate()

    Android OS version 7.1

    when I call Toasty in onCreate(), Toasty show only 1 sec. This probrem causes only Android 7.1. Toast.makeText(LENGTH_LONG).show() works fine.

    public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toasty.success(getApplicationContext(), "this toast show only 1 sec",  Toast.LENGTH_LONG).show(); // (A)
            }
        });
    
        Toasty.success(getApplicationContext(), "this toast show 4 sec", Toast.LENGTH_LONG).show(); // (B)
    
    
    
    }
    

    }

    help wanted 
    opened by nakawai 10
  • Toast padding is being removed with fitsSystemWindows set to true.

    Toast padding is being removed with fitsSystemWindows set to true.

    Hi @GrenderG , thanks for the great library! I have a question about how the text padding for Toasty is set. Usually, text in Toasty has a 16-20dp left right margin. However, when I am using the library in a fullscreen activity, the text padding disappears. What is setting the toast's text padding?

    P.S. I am currently adding spaces around my toast messages like " Toast Message " to simulate padding. It works great :D

    bug 
    opened by searchy2 9
  • No padding in toasty

    No padding in toasty

    Great library, just having an issue with it which I think is a bug. When I create any type of Toasty the text and icon have no right or left padding. Using Android 7.1.1 on API 25.

    invalid 
    opened by TobiPristupin 7
  • v1.2.0 Removes Set Text Color, Why?

    v1.2.0 Removes Set Text Color, Why?

    Hi @GrenderG , This library is absolutely amazing and I am currently using it in 3 apps! Today when I upgraded from v1.1.5 to 1.2.0, the existing code broke because the set text color value was removed. Why was set text color removed? How is text color controlled now? Thank you for your great work!

    question already done 
    opened by searchy2 7
  • Allow passing text as StringRes

    Allow passing text as StringRes

    Current:

    Toasty.info(context, context.getString(R.string.foo), Toast.LENGTH_SHORT).show();
    

    Request:

    Toasty.info(context, R.string.foo, Toast.LENGTH_SHORT).show();
    
    enhancement 
    opened by mueller-ma 5
  • Added Support for React Native Projects

    Added Support for React Native Projects

    Hi @GrenderG,

    First of all I would like to appreciate for creating such a cool toast library.

    I have created a React Native bridge plugin for using this library with React Native projects.

    I have added the same in README. Can you please merge this request so that if someone looking to use this library for React Native projects can easily do the same.

    Please let me know in case any changes are required

    react-native-toasty

    Thanks Pranav

    opened by prscX 5
  • Toasty - show message from resource

    Toasty - show message from resource

    Android Toast can use string resources without converting to CharSequence or String: Toast.makeText(context, R.string.connection_lost, Toast.LENGTH_SHORT).show(); in Toasty only this way: Toasty.error(context, context.getString(R.string.connection_lost), Toast.LENGTH_SHORT, true).show(); Add the ability to use string resources without converting!

    enhancement 
    opened by Bramengton 5
  • NullPointException shows when I make a toast

    NullPointException shows when I make a toast

    java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.String java.lang.CharSequence.toString()' on a null object reference at android.widget.ToastInjector.addAppName(ToastInjector.java:50) at android.widget.Toast.makeText(Toast.java:269) at es.dmoral.toasty.Toasty.custom(Toasty.java:171) at es.dmoral.toasty.Toasty.warning(Toasty.java:100)

    invalid 
    opened by EricZX123 5
  • It didn't work

    It didn't work

    Help me, I was using this repo for my project and And when I opened my project it told me the following.

    A problem occurred configuring root project 'TamilAudioProV4'.

    Could not resolve all artifacts for configuration ':classpath'. Could not find com.github.GrenderG:Toasty:1.5.2. Searched in the following locations: - https://dl.google.com/dl/android/maven2/com/github/GrenderG/Toasty/1.5.2/Toasty-1.5.2.pom - https://repo.maven.apache.org/maven2/com/github/GrenderG/Toasty/1.5.2/Toasty-1.5.2.pom - https://plugins.gradle.org/m2/com/github/GrenderG/Toasty/1.5.2/Toasty-1.5.2.pom Required by: project :

    Possible solution:

    • Declare repository providing the artifact, see the documentation at `https://docs.gradle.org/current/userguide/declaring_repositories.html```
    opened by Siu03 1
  • Migration to mavencentral

    Migration to mavencentral

    Are you ever planning to move this library to maven central or do you want us to stop using it and move to another library so that our project will still be working normally in future?

    opened by tarunpwar 2
Releases(1.5.2)
Owner
null
A library that extends the Android toast framework.

SuperToasts Library The SuperToasts library enhances and builds upon the Android Toast class. This library includes support for context sensitive Supe

John Persano 2.7k Dec 29, 2022
In-layout notifications. Based on Toast notifications and article by Cyril Mottier (http://android.cyrilmottier.com/?p=773).

Android AppMsg (Crouton) Library Implementation of in-layout notifications. Based on Toast notifications and article The making of Prixing #4: in-layo

Evgeny Shishkin 1.4k Nov 25, 2022
An Android Toast replacement, similar to the one seen in the GMail app.

MessageBar An Android Toast replacement, similar to the one seen in the GMail app. Multiple messages can be posted in succession, and each message wil

Simon Vig Therkildsen 555 Nov 25, 2022
๐Ÿž The missing toast library for Android.

Literally Toast ?? A toast library for Android. Usage: ?? Use the LitToast to get lit and show your users a proper toast. LitToast.create(context, "My

David Voiss 229 Nov 25, 2022
Toastie is a customizable Android toast library.

Toastie Getting Started Gradle Step 1. Add the JitPack repository to your build file Add it in your root build.gradle at the end of repositories: Note

Burak Fidan 36 Apr 3, 2021
A really simple library that help you to display a custom toast with many colors (for : success, warning, danger, info, dark, light, primary...etc ), or with rounded corners, or event with image.

CoolToast A really simple library that help you to display a custom toast with many colors (for : success, warning, danger, info, dark, light, primary

null 21 Dec 20, 2022
Android Custom Toast

Super Toast Library Written Purely in Kotlin โค๏ธ Usual Toast but with super powers!!! ?? A Fully Customised and Customisable Toast. ]( https://android-

null 26 Dec 27, 2022
Android Toast For RTL Applications

RTL-Toast Android library to show Toasts in a pretty RTL way Install Add it in your root build.gradle allprojects { repositories { ... ma

Arash Hatami 15 Nov 16, 2022
Attractive, stylish and customizable toast library for Android.

FabToast min SDK 16 (Jelly Bean 4.1) written in Java To download the demo app for this library from Google Playstore so you can see it in action, clic

Dean Spencer 11 Feb 14, 2022
Simple toast

newlibrary Simple toast Step 1. Add the JitPack repository to your build file allprojects { repositories { ... maven { url 'https://jitpack.io

Aziz Developer 0 Nov 5, 2021
An easy, flexible way to have the toast message displayed.

IToaster Library An easy, flexible way to have the toast message displayed. Download Gradle Add below codes to your root build.gradle file (not your m

Evans Kiptarus Kibet 1 Mar 19, 2022
Custom Toast Library by Google Developer Student Club University of Brawijaya

GDSCToast Custom Toast Library by Google Developer Student Club University of Brawijaya Prerequisites For old version of gradle (before arctic fox upd

Kylix Eza S 6 Sep 15, 2022
Customizable toast message library for Android

Android Custom Toast Message (SnToast) Customizable Toast Message Library For Android Add this in your root build.gradle file allprojects { reposito

null 9 Nov 15, 2021
MDToast - MaterialDesign Toast library written with Kotlin with lots of extensions to interact easily in contexts

MDToast - MaterialDesign Toast A lightweight Toast library written with Kotlin i

Morteza Omar Mohammady 12 Dec 23, 2022
Android : IamToast Another Toast library for Android

Android : IamToast Another Toast library for Android Warning. toast custom view is deprecated since android 11(R) Setup allprojects { repositories

null 2 Jun 12, 2022
This custom snack bar will help you display much more personalized app toast

?? Presentation Using the native android class of snack bar. This custom snack bar will help you display much more personalized app

Xavi 4 Dec 8, 2022
The usual Snackbar with more ๐Ÿซ and colours :tada:

ChocoBar The usual Snackbar with more ?? and colours ?? . Inspired by Light. GIF AndroidPub Post You can read the AndroidPub post about this library,

Pradyuman Dixit 124 Dec 20, 2022
Make your native android Toasts Fancy. A library that takes the standard Android toast to the next level with a variety of styling options. Style your toast from code.

FancyToast-Android Prerequisites Add this in your root build.gradle file (not your module build.gradle file): allprojects { repositories { ... ma

Shashank Singhal 1.2k Dec 26, 2022
CuteToast is an Material Design Custom Toast for Android | Custom Material Design Toast

CuteToast is an Android Custom Toast library that could be used instead of Default Toast. It does everything as Toast but with some extra spice.

K M Rejowan Ahmmed 12 Dec 17, 2022
A library that extends the Android toast framework.

SuperToasts Library The SuperToasts library enhances and builds upon the Android Toast class. This library includes support for context sensitive Supe

John Persano 2.7k Dec 29, 2022