Found 1966 Articles for Apps/Applications

How to get a complete address from latitude and longitude on Android Kotlin?

Azhar
Updated on 26-May-2020 08:22:12

2K+ Views

This example demonstrates how to get a complete address from latitude and longitude on 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.Intent import android.content.pm.PackageManager import android.location.Location import android.location.LocationManager import android.os.Bundle import android.os.Handler import android.os.Message import android.provider.Settings import android.widget.Button import android.widget.TextView import android.widget.Toast import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AppCompatActivity import androidx.core.app.ActivityCompat import androidx.core.content.ContextCompat class MainActivity : AppCompatActivity() {   ... Read More

How to Play an arbitrary tone in Android using Kotlin?

Azhar
Updated on 26-May-2020 08:07:24

729 Views

This example demonstrates how to Play an arbitrary tone in Android using KotlinStep 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.media.AudioFormat import android.media.AudioManager import android.media.AudioTrack import android.os.Bundle import android.os.Handler import androidx.appcompat.app.AppCompatActivity import kotlin.experimental.and import kotlin.math.sin class MainActivity : AppCompatActivity() {    private val duration = 10    private val sampleRate = 8000    private val numSamples = duration * sampleRate ... Read More

How to develop a soft keyboard for Android using Kotlin?

Azhar
Updated on 26-May-2020 07:58:33

736 Views

This example demonstrates how to develop a soft keyboard for 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.view.View import android.widget.EditText import android.widget.TextView import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() {    lateinit var editText: EditText    lateinit var textView: TextView    override fun onCreate(savedInstanceState: Bundle?) {       super.onCreate(savedInstanceState)       ... Read More

How to find the serial number of an Android device using Kotlin?

Azhar
Updated on 26-May-2020 07:49:31

2K+ Views

This example demonstrates how to find the serial number of 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.ktimport android.Manifest import android.app.AlertDialog import android.content.Context import android.content.pm.PackageManager import android.os.Build import android.os.Bundle import android.telephony.TelephonyManager import android.view.View import android.widget.Toast import androidx.appcompat.app.AppCompatActivity import androidx.core.content.ContextCompat class MainActivity : AppCompatActivity() {    private val requestState = 100    private var checkedPermission ... Read More

How to hide a soft keyboard on android after clicking outside EditText using Kotlin?

Azhar
Updated on 26-May-2020 07:41:36

2K+ Views

This example demonstrates how to hide a soft keyboard on android after clicking outside EditText 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 android.widget.TextView import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() {    lateinit var editText: EditText    lateinit var textView: TextView    override fun onCreate(savedInstanceState: Bundle?) { ... Read More

How to display count of notifications in the Android App launcher using Kotlin?

Azhar
Updated on 26-May-2020 07:37:07

418 Views

This example demonstrates how to display count of notifications in the Android App launcher 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.NotificationChannel import android.app.NotificationManager import android.app.PendingIntent import android.content.Context import android.content.Intent import android.os.Build import android.os.Bundle import android.view.View import androidx.appcompat.app.AppCompatActivity import androidx.core.app.NotificationCompat class MainActivity : AppCompatActivity() {    var count = 0    private val channelId = "10001"    private ... Read More

How to call an activity method from a fragment in Android App using Kotlin.

Azhar
Updated on 26-May-2020 07:32:36

4K+ Views

This example demonstrates how to call an activity method from a fragment in an Android App 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.Toast import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() {    override fun onCreate(savedInstanceState: Bundle?) {       super.onCreate(savedInstanceState)       setContentView(R.layout.activity_main)       title = "KotlinApp"       val fragmentManager ... Read More

How to change spinner text size and text color in Android App using Kotlin?

Azhar
Updated on 26-May-2020 07:26:36

6K+ Views

This example demonstrates how to change spinner text size and text color in Android App 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.ArrayAdapter import android.widget.Spinner import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() {    lateinit var spinner: Spinner       override fun onCreate(savedInstanceState: Bundle?) {       super.onCreate(savedInstanceState)       setContentView(R.layout.activity_main)       title = ... Read More

How to determine the size of an Android view at runtime using Kotlin?

Azhar
Updated on 26-May-2020 07:23:05

304 Views

This example demonstrates how to determine the size of an Android view at runtime 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 an image (.png/.jpg/.jpeg) into res/drawableStep 4 − Add the following code to src/MainActivity.ktimport android.os.Bundle import android.view.View import android.view.ViewTreeObserver.OnGlobalLayoutListener import android.widget.ImageView import android.widget.TextView import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() {    private lateinit var imageView: ImageView    override fun onCreate(savedInstanceState: Bundle?) { ... Read More

How to disable copy/paste from/to EditText in Android App using Kotlin?

Azhar
Updated on 26-May-2020 07:19:26

2K+ Views

This example demonstrates how to disable copy/paste from/to EditText in the Android App 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.view.ActionMode import android.view.Menu import android.view.MenuItem 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)       title ... Read More

Advertisements