Found 1966 Articles for Apps/Applications

How can I use marquee text in Kotlin?

Azhar
Updated on 20-Apr-2020 13:36:03

889 Views

This example demonstrates how to use marquee text in an Android Kotlin App.Step 1 − Create a new project in Android Studio, go to File ⇉ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     Step 3 − Add the following code to src/MainActivity.ktimport androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.widget.TextView class MainActivity : AppCompatActivity() {    override fun onCreate(savedInstanceState: Bundle?) {       super.onCreate(savedInstanceState)       setContentView(R.layout.activity_main)       title = "KotlinApp"       val text: String = "Simple application that shows how ... Read More

How to draw a smooth line following my finger using Kotlin?

Azhar
Updated on 20-Apr-2020 13:37:42

237 Views

This example demonstrates how to draw a smooth line following my finger using Android Kotlin.Step 1 − Create a new project in Android Studio, go to File ⇉ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.         Step 3 − Add the following code to src/MainActivity.ktimport android.graphics.Bitmap import android.graphics.Canvas import android.graphics.Color import android.graphics.Paint import android.os.Bundle import android.view.MotionEvent import android.view.View import android.widget.ImageView import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity(), View.OnTouchListener {    private lateinit var imageView: ImageView    private var bitmap: Bitmap? = null    var ... Read More

Send data from one Fragment to another using Kotlin?

Azhar
Updated on 20-Apr-2020 13:27:44

5K+ Views

This example demonstrates how to send data from one Fragment to another using Kotlin.Step 1 − Create a new project in Android Studio, go to File ⇉ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml. Step 3 − Create two FragmentActivity and add the codes which are given below.fragmentOne.xml −         FirstFragment.kt −import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.fragment.app.Fragment import kotlinx.android.synthetic.main.fragment_one.view.* class FirstFragment : Fragment() {    private lateinit var communicator: Communicator    override fun onCreateView(       inflater: LayoutInflater, ... Read More

How to use a simple SQLite database in Kotlin android?

Azhar
Updated on 20-Apr-2020 13:24:24

4K+ Views

This example demonstrates how to use a simple SQLite database in Kotlin android.Step 1 − Create a new project in Android Studio, go to File ⇉ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.                                    

How can I get the current time and date in Kotlin?

Azhar
Updated on 20-Apr-2020 13:15:21

1K+ Views

This example demonstrates how to get the current time and date in an Android app Kotlin.Step 1 − Create a new project in Android Studio, go to File ⇉ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     Step 3 − Add the following code to src/MainActivity.ktimport android.os.Bundle import android.widget.TextView import androidx.appcompat.app.AppCompatActivity import java.text.SimpleDateFormat import java.util.* class MainActivity : AppCompatActivity() {    override fun onCreate(savedInstanceState: Bundle?) {       super.onCreate(savedInstanceState)       setContentView(R.layout.activity_main)       val textView: TextView = findViewById(R.id.dateAndTime)       ... Read More

How to handle swipe gestures in Kotlin?

Azhar
Updated on 20-Apr-2020 13:13:11

4K+ Views

This example demonstrates how to handle swipe gestures in an android device using Kotlin.Step 1 − Create a new project in Android Studio, go to File ⇉ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     Step 3 − Add the following code to src/MainActivity.ktpackage app.com.kotlinapp import android.os.Bundle import android.widget.RelativeLayout import android.widget.Toast import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() {    private lateinit var layout: RelativeLayout    override fun onCreate(savedInstanceState: Bundle?) {       super.onCreate(savedInstanceState)       setContentView(R.layout.activity_main)       layout = findViewById(R.id.relativeLayout)   ... Read More

How to track the current location (Latitude and Longitude) in an android device using Kotlin?

Azhar
Updated on 20-Apr-2020 13:07:00

2K+ Views

This example demonstrates how to track the current location (Latitude and Longitude) in an android device using Kotlin.Step 1 − Create a new project in Android Studio, go to File ⇒New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.             Step 3 − Add the following code to src/MainActivity.ktpackage app.com.kotlipapp import android.Manifest import android.content.Intent import android.content.pm.PackageManager import android.location.Location import android.net.Uri import android.os.Build import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.provider.Settings import android.util.Log import android.view.View import android.widget.TextView import android.widget.Toast import androidx.core.app.ActivityCompat import com.google.android.gms.location.FusedLocationProviderClient import com.google.android.gms.location.LocationServices class ... Read More

How to create a notification alert using Kotlin?

Azhar
Updated on 20-Apr-2020 12:57:49

1K+ Views

This example demonstrates how to create a notification alert using Kotlin.Step 1 − Create a new project in Android Studio, go to File ⇒New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     Step 3 − Add the following code to src/MainActivity.ktpackage app.com.kotlinapp import android.app.* import android.content.Context import android.content.Intent import android.graphics.BitmapFactory import android.graphics.Color import android.os.Build import android.os.Bundle import android.view.View import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() {    lateinit var notificationChannel: NotificationChannel    lateinit var notificationManager: NotificationManager    lateinit var builder: Notification.Builder    private val channelId = "12345" ... Read More

How to create a multilevel listView using Kotlin?

Azhar
Updated on 20-Apr-2020 12:56:15

255 Views

This example demonstrates how to create a multilevel listView using Kotlin Android.Step 1 − Create a new project in Android Studio, go to File ⇉ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml. Step 3 − Add the following code to src/MainActivity.ktpackage app.com.kotlinapp import android.os.Bundle import androidx.appcompat.app.AppCompatActivity import kotlinx.android.synthetic.main.activity_main.* class MainActivity : AppCompatActivity() {    private val header: MutableList = ArrayList()    private val body: MutableList = ArrayList()    override fun onCreate(savedInstanceState: Bundle?) {       super.onCreate(savedInstanceState)       setContentView(R.layout.activity_main)       val myFavCricketPlayers: ... Read More

How to listen for Webview loading a URL using Kotlin?

Azhar
Updated on 20-Apr-2020 12:39:51

1K+ Views

This example demonstrates how to listen for a webview finishing loading a URL in android.Step 1 − Create a new project in Android Studio, go to File ⇒New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.             Step 3 − Add the following code to src/MainActivity.ktpackage app.com.kotlinapp import android.os.Bundle import android.view.View import android.webkit.WebChromeClient import android.webkit.WebView import android.webkit.WebViewClient import android.widget.Button import android.widget.TextView import android.widget.Toast import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() {    private var webView: WebView? = null       private ... Read More

Advertisements