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.

Last update: Jun 17, 2022

FancyToast-Android

platform API License Android Arsenal Recommend me on LinkedIn

Get it on Google Play

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.Shashank02051997:FancyToast-Android:0.1.8'
}

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 default Toast:

FancyToast.makeText(this,"Hello World !",FancyToast.LENGTH_LONG,FancyToast.DEFAULT,true);

To display a success Toast:

FancyToast.makeText(this,"Hello World !",FancyToast.LENGTH_LONG,FancyToast.SUCCESS,true);

To display an info Toast:

FancyToast.makeText(this,"Hello World !",FancyToast.LENGTH_LONG,FancyToast.INFO,true);

To display a warning Toast:

FancyToast.makeText(this,"Hello World !",FancyToast.LENGTH_LONG,FancyToast.WARNING,true);

To display the error Toast:

FancyToast.makeText(this,"Hello World !",FancyToast.LENGTH_LONG,FancyToast.ERROR,true);

To display the confusing Toast:

FancyToast.makeText(this,"Hello World !",FancyToast.LENGTH_LONG,FancyToast.CONFUSING,true);

You can also remove the android icon on top-right corner by passing last parameter false.

FancyToast.makeText(yourContext, "I'm a Toast", duration, type, boolean value).show();

You can also create your custom Toasts with passing your image with or without android icon(top-right corner):

FancyToast.makeText(yourContext, "I'm a custom Toast", duration, type, yourimage, boolean value).show();

To display the custom Toast with no android icon:

FancyToast.makeText(this, "This is Custom Toast with no android icon", FancyToast.LENGTH_LONG, FancyToast.CONFUSING, R.drawable.ic_android_black_24dp, false);

Screenshots

Please click the image below to enlarge.

Contributing

Please fork this repository and contribute back using pull requests.

Any contributions, large or small, major features, bug fixes, are welcomed and appreciated but will be thoroughly reviewed .

Contact - Let's become friend

Don't forget to star the repo it motivates me to share more open source

Donation

If this project help you reduce time to develop, you can give me a cup of coffee :)

Buy Me A Coffee

License

Copyright 2020 Shashank Singhal

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

GitHub

https://github.com/Shashank02051997/FancyToast-Android
Comments
  • 1. Remove Android Icon

    Amazing looking toasts! I love the raised bubbly look. It is perfect for a certain style of apps and has not been shared on Github before. Thank you!

    Is it possible to provide an option to remove the Android Icon in the top right corner of the toasts? That icon is somewhat distracting. Thank you!

    Reviewed by searchy2 at 2017-10-22 19:42
  • 2. Changing Background Color and Customization of Toast.

    Hi, I am unable to change the background color or customize the toast. I want to increase its Width and Height. and even change the color of the Toast's background.

    Reviewed by Afaqrehman98 at 2021-05-12 19:18
  • 3. Changed String message type to CharSequence

    I propose this change because in my App I need to use Spannable to have texts with different colors in the toasts. CharSequence seems a good parent of both String and Spannable and I think it's working fine.

    By the way, thanks for this simple but nice lib! Congrats :)

    Reviewed by LluisFelip at 2019-07-04 16:49
  • 4. duration not working please advise.

    Used newer as well as older version both having same issue. //implementation 'com.github.Shashank02051997:FancyToast-Android:0.1.8' implementation 'io.github.shashank02051997:FancyToast:2.0.1'

    FancyToast.makeText(getApplicationContext(), msg,5000 , FancyToast.SUCCESS, false).show();

    Reviewed by sagar0701 at 2021-08-04 12:48
  • 5. Using Gravity

    Using Gravity within the Toast makes .show() come up red:

    FancyToast.makeText(Login.this, "Welcome! Please Login", FancyToast.LENGTH_SHORT, FancyToast.INFO, false).setGravity(Gravity.CENTER_HORIZONTAL, 0, 0).show();

    Reviewed by PassionateSolutions at 2019-08-16 16:13
  • 6. java.lang.RuntimeException

    In Google Play Console - Android vitals under "Installed from anywhere" I am getting java.lang.RuntimeException com.shashank.sony.fancytoastlib.FancyToast.a

    Caused by: java.lang.RuntimeException: at android.widget.Toast$TN.<init> (Toast.java:433) at android.widget.Toast.<init> (Toast.java:118) at android.widget.Toast.<init> (Toast.java:109) at com.shashank.sony.fancytoastlib.FancyToast.a (FancyToast.java:2) at games.moisoni.evfp.MainActivity.a (MainActivity.java:13) at com.anjlab.android.iab.v3.BillingProcessor.getPurchasePayload (BillingProcessor.java) at com.anjlab.android.iab.v3.BillingProcessor.detectPurchaseTypeFromPurchaseResponseData (BillingProcessor.java) at com.anjlab.android.iab.v3.BillingProcessor.handleActivityResult (BillingProcessor.java) at com.anjlab.android.iab.v3.BillingProcessor.loadPurchasesByType (BillingProcessor.java) at com.anjlab.android.iab.v3.BillingProcessor.f (BillingProcessor.java:4) at com.anjlab.android.iab.v3.BillingProcessor$HistoryInitializationTask.doInBackground (BillingProcessor.java) at com.anjlab.android.iab.v3.BillingProcessor$HistoryInitializationTask.doInBackground (BillingProcessor.java) at android.os.AsyncTask$2.call (AsyncTask.java:333) at java.util.concurrent.FutureTask.run (FutureTask.java:266) at android.os.AsyncTask$SerialExecutor$1.run (AsyncTask.java:245) at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1162) at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:636) at java.lang.Thread.run (Thread.java:764)

    This happens only in "Installed from anywhere" not from Play Store. I also use in-app purchase v3 library and use this toast to confirm the purchase and eventually errors.

    `@Override public void onProductPurchased(@NonNull String productId, @Nullable TransactionDetails details) { if (productId.equalsIgnoreCase("android.test.purchased")) { //real - remove_ads_purchase |||| // test - android.test.purchased YoYo.with(Techniques.FadeOutUp) .duration(500) .repeat(0) .playOn(findViewById(R.id.relative_ads)); findViewById(R.id.no_ads_line).setVisibility(View.GONE);

            //If purchasedCounter = 1 don't show ads
            purchasedCounter = 1;
    
            //Save purchase
            SharedPreferences savePurchase = getSharedPreferences("MyPurchase", Context.MODE_PRIVATE);
            SharedPreferences.Editor editorPurchase = savePurchase.edit();
            editorPurchase.putInt("purchase", purchasedCounter);
            editorPurchase.apply();
    
            FancyToast.makeText(MainActivity.this, "Done! Thanks for your purchase!",
                    FancyToast.LENGTH_LONG, FancyToast.SUCCESS, false).show();
    
            //Restart activity for changes to take effect
            Intent intent = new Intent(MainActivity.this, MainActivity.class);
            startActivity(intent);
            finish();
            Animatoo.animateFade(MainActivity.this);
        }
    }`
    
    Reviewed by moisoni97 at 2019-04-23 16:02
  • 7. Why FancyToast class is extending Toast class?

    I don't know why FancyToast class is extending from Toast class when your class is using static method and using default Toast class to do all the stuff?

    Reviewed by khawarraza-netsoltech at 2018-12-14 10:54
  • 8. margin attributes changed

    Using Gravity#LEFT and Gravity#RIGHT can lead to problems when a layout is rendered in locales where text flows from right to left. Use Gravity#START and Gravity#END instead.

    Similarly, in XML gravity and layout_gravity attributes, use start rather than left. For XML attributes such as paddingLeft and layout_marginLeft, use paddingStart and layout_marginStart.

    NOTE: If your minSdkVersion is less than 17, you should add both the older left/right attributes as well as the new start/right attributes. On older platforms, where RTL is not supported and the start/right attributes are unknown and therefore ignored, you need the older left/right attributes. There is a separate lint check which catches that type of error. (Note: For Gravity#LEFT and Gravity#START, you can use these constants even when targeting older platforms, because the start bitmask is a superset of the left bitmask. Therefore, you can use gravity="start" rather than gravity="left|start".)

    Reviewed by thenishchalraj at 2018-10-03 07:32
  • 9. Added Annotations

    Using annotations improve code readability and usability. Try to use annotations or enums wherever possible, so that end user has better readability and understanding that what type of integer or some data class is required.

    Reviewed by rooparsh at 2021-08-06 16:23
:bread: Make your native android Toasts Tasty
:bread: Make your native android Toasts Tasty

TastyToast Make your native android toast look beautiful. Preview About Refer Here Wiki Grab the above demo app from here : Dependency Add dependency

Jun 16, 2022
A backport of the SwitchPreference component that was introduced on Android 4 (ICS / level 14). This port works on Android 2.1+ (Eclair MR1 / level 7).

Android Switch Preference Backport A backport of the SwitchPreference component that was introduced on Android 4 (ICS / level 14). This port works on

May 11, 2022
A cool Open Source CoverFlow view for Android with several fancy effects.
A cool Open Source CoverFlow view for Android with several fancy effects.

FancyCoverFlow THIS PROJECT IS NO LONGER MAINTAINED! What is FancyCoverFlow? FancyCoverFlow is a flexible Android widget providing out of the box view

Apr 29, 2022
Takes the input from the Android MediaPlayer and displays visualizations, like in iTunes or WinAmp
Takes the input from the Android MediaPlayer and displays visualizations, like in iTunes or WinAmp

Android Visualizer A View subclass that Takes the input from the Android MediaPlayer and displays visualizations, like in iTunes or WinAmp The Visuali

Jun 20, 2022
Nature takes back over.

ShatteredReclamation This is a plugin that allows the wild to slowly take player creations back over. Config Threads This plugin uses multiple threads

Mar 17, 2022
Multi Roots TreeView implementation for Android Platform with a lot of options and customization
Multi Roots TreeView implementation for Android Platform with a lot of options and customization

Multi roots TreeView :palm_tree: implementation for Android Platform with a lot of options and customization

Jun 9, 2022
A full options clock view
A full options clock view

Clock View Full options Clock view. You are now able to create and design your own clock view with changing just attributes. Over 20 attributes are av

Apr 8, 2022
Allows you to launch various /hidden/ options of the Oculus Quest (2)

vrLauncher Allows you to launch various /hidden/ options of the Oculus Quest (2) Using it Sideload the apk onto your Oculus Quest (2) Choose the optio

Jun 3, 2022
Card with swipe options in Jetpack Compose

SwipeableActionCard Card with swipe options in Jetpack Compose Tutorial: Click Here Import SwipeableActionCard library Add this in project level build

Nov 23, 2021
Provides 9-patch based drop shadow for view elements. Works on API level 9 or later.
Provides 9-patch based drop shadow for view elements. Works on API level 9 or later.

Material Shadow 9-Patch This library provides 9-patch based drop shadow for view elements. Works on API level 14 or later. Target platforms API level

Jun 3, 2022
Display code with syntax highlighting :sparkles: in native way.
Display code with syntax highlighting :sparkles: in native way.

CodeView (Android) CodeView helps to show code content with syntax highlighting in native way. Description CodeView contains 3 core parts to implement

Jun 11, 2022
Make a cool intro for your Android app.
Make a cool intro for your Android app.

AppIntro AppIntro is an Android Library that helps you build a cool carousel intro for your App. AppIntro has support for requesting permissions and h

Jun 20, 2022
Make a cool intro for your Android app.
Make a cool intro for your Android app.

AppIntro AppIntro is an Android Library that helps you build a cool carousel intro for your App. AppIntro has support for requesting permissions and h

Jun 16, 2022
Bootstrap style widgets for Android, with Glyph Icons
Bootstrap style widgets for Android, with Glyph Icons

Android-Bootstrap Android Bootstrap is an Android library which provides custom views styled according to the Twitter Bootstrap Specification. This al

Jun 15, 2022
A util for setting status bar style on Android App.
A util for setting status bar style on Android App.

StatusBarUtil A util for setting status bar style on Android App. It can work above API 19(KitKat 4.4). 中文版点我 Sample Download StatusBarUtil-Demo Chang

Jun 18, 2022
An Android custom view to display digits rendered as dots in a grid, with a style like a 1970s LED clock.
An Android custom view to display digits rendered as dots in a grid, with a style like a 1970s LED clock.

#DotMatrixView This is an Android library project providing a custom view that can display things on a grid of dots. When the displayed value changes,

Apr 21, 2022
This is a sample Android Studio project that shows the necessary code to create a note list widget, And it's an implementation of a lesson on the Pluralsight platform, but with some code improvements
This is a sample Android Studio project that shows the necessary code to create a note list widget, And it's an implementation of a lesson on the Pluralsight platform, but with some code improvements

NoteKeeper-Custom-Widgets This is a sample Android Studio project that shows the necessary code to create a note list widget, And it's an implementati

Nov 7, 2021
Kotlin/Native interop to libui: a portable GUI library
Kotlin/Native interop to libui: a portable GUI library

kotlin-libui Kotlin/Native bindings to the libui C library. libui is a C lightweight multi-platform UI library using native widgets on Linux (Gtk3), m

Jun 22, 2022
A set of Android-UI components to make it easier to request permission in a user friendly way.
A set of Android-UI components to make it easier to request permission in a user friendly way.

Permission UI A set of Android-UI components to make it easier to request permission in a user friendly way. Access background location A jetpack comp

May 25, 2022