Found 1966 Articles for Apps/Applications

How to display progress dialog before starting an activity in Android using Kotlin?

Azhar
Updated on 18-Aug-2020 11:04:05

275 Views

This example demonstrates how to display progress dialog before starting an activity in Android 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.ktimport android.app.ProgressDialog import android.os.AsyncTask import android.os.Bundle import androidx.appcompat.app.AppCompatActivity @Suppress("DEPRECATION") class MainActivity : AppCompatActivity() {    private lateinit var progressDialog: ProgressDialog    override fun onCreate(savedInstanceState: Bundle?) {       super.onCreate(savedInstanceState)       setContentView(R.layout.activity_main)       title ... Read More

How to permanently hide the Navigation Bar in an Android activity using Kotlin?

Azhar
Updated on 18-Aug-2020 11:01:29

1K+ Views

This example demonstrates how to permanently hide the Navigation Bar in an Android activity 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.ktimport android.os.Build import android.os.Bundle import android.view.View import androidx.appcompat.app.AppCompatActivity @Suppress("DEPRECATED_IDENTITY_EQUALS", "DEPRECATION") class MainActivity : AppCompatActivity() {    private var currentApiVersion: Int = 0    override fun onCreate(savedInstanceState: Bundle?) {       super.onCreate(savedInstanceState)       setContentView(R.layout.activity_main)     ... Read More

How to convert milliseconds to date format in Android using Kotlin?

Azhar
Updated on 18-Aug-2020 10:55:44

5K+ Views

This example demonstrates how to convert milliseconds to date format in Android 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.ktimport android.os.Bundle import android.widget.TextView import androidx.appcompat.app.AppCompatActivity import java.text.SimpleDateFormat class MainActivity : AppCompatActivity() {    override fun onCreate(savedInstanceState: Bundle?) {       super.onCreate(savedInstanceState)       setContentView(R.layout.activity_main)       title = "KotlinApp"       val textView: TextView = ... Read More

How to hide status bar in Android using Kotlin?

Azhar
Updated on 18-Aug-2020 09:30:12

824 Views

This example demonstrates how to hide status bar in Android 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.ktimport androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.view.Window import android.view.WindowManager class MainActivity : AppCompatActivity() {    override fun onCreate(savedInstanceState: Bundle?) {       super.onCreate(savedInstanceState)       requestWindowFeature(Window.FEATURE_NO_TITLE)       window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,       WindowManager.LayoutParams.FLAG_FULLSCREEN)       setContentView(R.layout.activity_main)       title = ... Read More

How to create a text file and insert data to that file on Android using Kotlin?

Azhar
Updated on 18-Aug-2020 09:27:13

2K+ Views

This example demonstrates how to create a text file and insert data to that file on Android 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.ktimport android.content.Context import android.os.Bundle import android.view.View import android.widget.EditText import android.widget.Toast import androidx.appcompat.app.AppCompatActivity import java.io.FileOutputStream import java.io.OutputStreamWriter class MainActivity : AppCompatActivity() {    lateinit var editText: EditText   ... Read More

How to use Font Awesome in Native Android Application using Kotlin?

Azhar
Updated on 18-Aug-2020 09:22:06

225 Views

This example demonstrates how to use Font Awesome in Native Android Application 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 a new download asset folder. Copy-paste the fontAwesome.ttf In the asset folder.Step 4 − Add the following code to src/MainActivity.ktimport android.graphics.Typeface import android.os.Bundle import android.widget.TextView import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() {    override fun onCreate(savedInstanceState: Bundle?) {       super.onCreate(savedInstanceState)     ... Read More

How can I remove a button or make it invisible in Android using Kotlin?

Azhar
Updated on 18-Aug-2020 09:19:57

2K+ Views

This example demonstrates how to remove a button or make it invisible in Android 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.ktimport androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.view.View import android.widget.Button import android.widget.Toast class MainActivity : AppCompatActivity() {    override fun onCreate(savedInstanceState: Bundle?) {       super.onCreate(savedInstanceState)       setContentView(R.layout.activity_main)       title = "KotlinApp"       ... Read More

How to detect Scroll Up & Scroll down in Android ListView using Kotlin?

Azhar
Updated on 18-Aug-2020 09:16:20

803 Views

This example demonstrates how to detect Scroll Up & Scroll down in Android ListView 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.ktimport android.os.Bundle import android.widget.* import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() {    private var scrollView: ScrollView? = null    private lateinit var listView: ListView    private var numbers = arrayOf(       "1",       "2",     ... Read More

How to detect Android user agent type in general using kotlin?

Azhar
Updated on 18-Aug-2020 09:13:09

357 Views

This example demonstrates how to detect Android user agent type in general 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.ktimport android.content.Context import android.media.AudioManager import android.os.Bundle import android.widget.Toast import androidx.appcompat.app.AppCompatActivity import java.util.* class MainActivity : AppCompatActivity() {    override fun onCreate(savedInstanceState: Bundle?) {       super.onCreate(savedInstanceState)       setContentView(R.layout.activity_main)       title = "KotlinApp"       ... Read More

How to add a line break in an Android TextView using Kotlin?

Azhar
Updated on 18-Aug-2020 09:08:47

702 Views

This example demonstrates how to add a line break in an Android TextView using Kotlin.space_on_android_devicesStep 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.Color import 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 textView: TextView ... Read More

Advertisements