Posts

Showing posts with the label Android concepts

Toast in Android.

 Toast in Android.  /    SNACKBAR / (for permanent display notification can be used) sdfsdf / Toast . makeText ( MainActivity . this , "login Successfully" , Toast . LENGTH_SHORT ) . show(); Context context = getApplicationContext (); CharSequence text = "Hello toast!" ; int duration = Toast . LENGTH_SHORT ; Toast toast = Toast . makeText ( context , text , duration ); toast . show (); FOR STYLEABLE TOAST First implement latest dependency. dependencies { implementation 'io.github.muddz:styleabletoast:2.4.0' } Next, go to values -> style -> create new <style name = "signuptoast"> layout < style name ="signupToast" > < item name ="stColorBackground" > #228B22 </ item > < item name ="stTextBold" > true </ item > < item name ="stTextColor" > #fff </ item > < item name ="stFont" > @font/retrofont </ item

How to implement animation or lottie files in android.

Image
 How to implement animation or lottie files in android. First of all, implement latest dependency in build.gradle file. implementation 'com.airbnb.android:lottie:4.1.0' //for lottie files Create one raw folder and put your JSON file in that Then in xml file put this code. < com.airbnb.lottie.LottieAnimationView android :id ="@+id/animationView" android :layout_width ="100dp" android :layout_height ="80dp" app :lottie_autoPlay ="true" app :lottie_loop ="true" app :lottie_rawRes ="@raw/lottie" /> //here put your own lottie file have a great day.  

Toast

Image
  TOAST   A Toast is short message display on the screen. Toast provide simple feedback message with a popup message. Toast automatically disappear after a timeout. Example :-   clicking  Send  on an email triggers a "Sending message..." toast. Context context = getApplicationContext (); CharSequence text = "Hello Shraddha Nand Pandey" ; int duration = Toast . LENGTH_SHORT ; Toast toast = Toast . makeText ( context , text , duration ); toast . show ();// in built function to show toast XML CODE:- <? xml version ="1.0" encoding ="utf-8" ?> < androidx.constraintlayout.widget.ConstraintLayout xmlns: android ="http://schemas.android.com/apk/res/android" xmlns: app ="http://schemas.android.com/apk/res-auto" xmlns: tools ="http://schemas.android.com/tools" android :layout_width ="match_parent" android :layout_height ="match_parent" tools :context =".MainActiv