Monday 11 May 2020

Kotlin - Enum Classes in Kotlin | Enum Methods | Enum Properties

Hello Friend,
              Today I am going to share about Enum class in Kotlin
 

- How to create/initialize enum classes
- methods and properties of enum classes.



Initializing enums –


Now we can easily access the color of fruits,
Enum Methods-

  1. values: This method returns a list of all the constants defined within the enum class.
  2. valueOf: This methods returns the enum constant defined in enum, matching the input string.  If the constant, is not present in the enum, then an IllegalArgumentException is thrown.

Enum Properties-

  1. ordinal: This property stores the ordinal value of the constant, which is usually a zero-based index.
  2. name: This property stores the name of the constant.
Below is the example which help us to understand the uses of Enum method and Properties.
Outputs:

Hope this will help some one.
Enjoy Coding... :)

Kotlin - Android notification in kotlin | Android MVP in Kotlin

Hello Friends,
       Lets first tell you what is notification.


Notification is a message that is used to display some short messages outside of our main application. Even if the app is not running, notifications will still work. Notifications have the following contents: an icon, title of notification and some text content.

Now today I am going to share , how create notification in Kotlin.

Download code from here
Hope this will helps someone..
Enjoy Coding.... :)

 

Copyright @ 2013 Android Developers Blog.