- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 1966 Articles for Apps/Applications
![Azhar](https://www.tutorialspoint.com/assets/profiles/124637/profile/60_166181-1565938637.jpg)
375 Views
This example demonstrates how to get the ActionBar height 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.Button import android.widget.TextView import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.widget.Toolbar class MainActivity : AppCompatActivity() { lateinit var toolbar: Toolbar lateinit var button: Button lateinit var textView: TextView override fun onCreate(savedInstanceState: Bundle?) { ... Read More
![Azhar](https://www.tutorialspoint.com/assets/profiles/124637/profile/60_166181-1565938637.jpg)
476 Views
This example demonstrates how to make an alert dialog fill 50% of screen size on Android devices 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.util.DisplayMetrics import android.view.WindowManager import android.widget.Button import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() { lateinit var button: Button override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) ... Read More
![Azhar](https://www.tutorialspoint.com/assets/profiles/124637/profile/60_166181-1565938637.jpg)
924 Views
This example demonstrates how to overlay two images in Android to set an imageview 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 − Copy and paste two images in the res / drawable that you want to overlay(Merge) Then create a drawable resource file (layer.xml) and add the following code, Step 4 − Add the following code to src/MainActivity.ktimport android.annotation.SuppressLint ... Read More
![Azhar](https://www.tutorialspoint.com/assets/profiles/124637/profile/60_166181-1565938637.jpg)
1K+ Views
This example demonstrates how to show a Soft Keyboard based on Android EditText focused 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.view.inputmethod.InputMethodManager import android.widget.EditText import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() { lateinit var editText: EditText override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) ... Read More
![Azhar](https://www.tutorialspoint.com/assets/profiles/124637/profile/60_166181-1565938637.jpg)
2K+ Views
This example demonstrates how to set maximum date in datepicker dialog 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.DatePickerDialog import android.os.Bundle import android.widget.TextView import androidx.appcompat.app.AppCompatActivity import java.text.SimpleDateFormat import java.util.* class MainActivity : AppCompatActivity() { private var year = 0 private var month = 0 private var day = 0 lateinit var textView: ... Read More
![Azhar](https://www.tutorialspoint.com/assets/profiles/124637/profile/60_166181-1565938637.jpg)
2K+ Views
This example demonstrates how to pass a String from one Activity to another 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.content.Intent import android.os.Bundle import android.widget.Button import android.widget.EditText import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() { lateinit var changeActivityButton: Button lateinit var messageEditText: EditText override fun onCreate(savedInstanceState: Bundle?) { ... Read More
![Azhar](https://www.tutorialspoint.com/assets/profiles/124637/profile/60_166181-1565938637.jpg)
1K+ Views
This example demonstrates how to change Screen Orientation programmatically using a Button in 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.content.pm.ActivityInfo import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.widget.Button import android.widget.Toast class MainActivity : AppCompatActivity() { lateinit var buttonLandscape: Button lateinit var buttonPortrait: Button override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) ... Read More
![Azhar](https://www.tutorialspoint.com/assets/profiles/124637/profile/60_166181-1565938637.jpg)
641 Views
This example demonstrates how to communicate between Activity and Service 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.Service import android.content.Intent import android.media.MediaPlayer import android.os.Bundle import android.os.IBinder import android.view.View import android.widget.Button import android.widget.Toast import androidx.annotation.Nullable import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity(), View.OnClickListener { private lateinit var buttonStart: Button private lateinit var buttonStop: Button ... Read More
![Azhar](https://www.tutorialspoint.com/assets/profiles/124637/profile/60_166181-1565938637.jpg)
210 Views
This example demonstrates how to execute an Async task repeatedly after fixed time intervals 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.AsyncTask import android.os.Bundle import android.os.Handler import android.widget.Toast @Suppress("DEPRECATION") class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) title = "KotlinApp" ... Read More
![Azhar](https://www.tutorialspoint.com/assets/profiles/124637/profile/60_166181-1565938637.jpg)
587 Views
This example demonstrates how to detect user inactivity for 5 seconds 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.os.Handler import android.widget.Toast import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() { lateinit var handler: Handler lateinit var runnable: Runnable override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) ... Read More