Posts

Showing posts with the label kotlin_example

android kotlin current date example

In this An article today learn get current date android for using kotlin language to follow the code:   val current = LocalDateTime.now()           val formatter = DateTimeFormatter.ofPattern("dd.MM.yyyy. HH:mm:ss")           label_date.text = current.format(formatter)   Follow the code for  android kotlin current date example: 1.MainActivity.kt: import java.time.LocalDateTime import java.time.format.DateTimeFormatter class MainActivity: AppCompatActivity() {     override fun onCreate(savedInstanceState: Bundle?) {         super.onCreate(savedInstanceState)         setContentView(R.layout.activity_main)         val current = LocalDateTime.now()         val formatter = DateTimeFormatter.ofPattern("dd.MM.yyyy. HH:mm:ss")         label_date.text = current.format(formatter)...

android kotlin listview example

In this article, today learn android kotlin listview example . Listview is a set of array adapter. for the more information visit google developer listview Android ListView displays data vertically with each item positioned below the previous data items. ListView is scrollable. You can use ListView without any issues for displaying a few data items in UI. But for displaying large volumes of data as a list, you need to use  to build well-performing apps.        1.MainActivity.kt: import android.support.v7.app.AppCompatActivity   import android.os.Bundle   import android.widget.Toast   import kotlinx.android.synthetic.main.activity_main.*         class MainActivity : AppCompatActivity() {       val fruit = arrayOf<String>("Mango","cocunt","apple","Cherry","orange")       val description = arrayOf<String>(         ...

Kotlin camera intent example

Kotlin camera intent example today learn this topic. Camera intent kotlin source code. From this Article. Follow the manifest permission using permission camera open. for more information visit google developer page   If an the kotlin camera intent example essential function of your application is taking pictures, then restrict its visibility on Google Play to devices that have a camera. To advertise that your application depends on having a camera, put a   <uses-feature>  tag in your manifest file:   <manifest ... >     <uses-feature android:name="android.hardware.camera"                   android:required="true" />     ... </manifest>   The Android way of delegating actions to other applications is to invoke an  Intent  that describes what you want done. This process involves three pieces...

android kotlin toast example

In this Article today learn android kotlin toast example . toast is using the display message. from the android app. The message displayed using Toast class displays quickly android kotlin toast example . follow the source code kotlin toast example. for more information visit google developer. follow the source code for android kotlin toast example. 1.MainActivity.kt: package example.akash.kotlintoast      import android.support.v7.app.AppCompatActivity   import android.os.Bundle   import android.view.Gravity   import android.widget.Toast   import kotlinx.android.synthetic.main.activity_main.*      class MainActivity : AppCompatActivity() {          override fun onCreate(savedInstanceState: Bundle?) {           super.onCreate(savedInstanceState)           setContentView(R.layout.activity_main)   ...

kotlin notification example

Android Notification gives short, convenient data about the activity occurred in the application, even it isn't running. The notification shows the symbol, title and some measure of the substance content. Notification is a message that is utilized to show some short messages outside of our primary application. Regardless of whether the application isn't running, notifications will in any casework. Notifications have the accompanying substance: a symbol, title of notification and some content substance. follow the example    kotlin notification example Set Android Notification Properties setSmallIcon() : it sets the icon of notification. setContentTitle() : it is used to set the title of notification. setContentText() : it is used to set the text message. setAutoCancel() : it sets the cancelable property of notification. setPriority() : it sets the priority of notification. 1.MainActivity.kt: import android.app.NotificationMana...

kotlin android textview

In this article today learn how to declare textview in  kotlin android so follow the example of the kotlin android textview. follow the source code  kotlin android textview: 1.MainActivity.kt: import androidx.appcompat.app.AppCompatActivity  import android.os.Bundle  import android.widget.TextView  import android.widget.Toast     class MainActivity : AppCompatActivity() {             override fun onCreate(savedInstanceState: Bundle?) {              super.onCreate(savedInstanceState)              setContentView(R.layout.activity_main)                 //accessing our textview from layout              val textView = findViewById<TextView>(R.id.text_view_id) as TextView              textView?.setOnClickListener{ To...

kotlin intent example

In this article today learn kotlin intent example. For android studio. Intent as using a one activity to another activity so follow the source code kotlin intent example. Android Intent is an informing object used to demand another application part to play out an activity. Intent encourages clients to speak with application segment through a few different ways, for example, beginning an activity, beginning a help, conveying a communicate recipient, and so on.   Intents (android.content.Intent) are the informing framework by which one activity can dispatch another activity. An activity can, for example, issue an intent to demand the dispatch of another activity contained inside a similar application. Intents additionally, be that as it may, go past this idea by permitting an activity to demand the administrations of some other suitably enrolled activity on the gadget for which authorizations are arranged. Consider, for example, an activity contained inside an application that ...