You can generate a toast message easily and fast by Toaster.
Toaster has four styles for different statuses that include information, success, warning, and error.
Add this line to your build.gradle
file:
dependencies {
implementation 'com.github.mhadikz:toaster:1.0.0'
}
Toaster needs some parameters for generating your toast and call show()
. You have to create a builder for showing Toaster message:
new Toaster.Builder(<Context>)
.setTitle(<Title text>)
.setDescription(<Description text>)
.setDuration(<Duration time by selecting from Toaster>)
.setStatus(<Toast status by selecting from Toaster.Status>)
.show();
new Toaster.Builder(this)
.setTitle(getString(R.string.info_title))
.setDescription(getString(R.string.info_description))
.setDuration(Toaster.LENGTH_SHORT)
.setStatus(Toaster.Status.INFO)
.show();
Copyright 2020 Mohammad Hadi Karamzadeh
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.