Found 1966 Articles for Apps/Applications

The Bluetooth Link Layers

Mandalika
Updated on 11-Sep-2020 08:28:01

3K+ Views

The Bluetooth link layer outlines the way Bluetooth devices can use the raw transmission facility given by the radio layer to exchange information. The functions of the link layer is very close to MAC (medium access control) sublayer of the OSI model.The following diagram shows the position of link layers in the Bluetooth protocol architecture −Functions of the Bluetooth Link LayerDefining procedures for discovering Bluetooth devices.Establishing logical links between the Bluetooth devices that are communicating. One of the devices is assigned as master and the other is the slave.Broadcasting data to be sent. Managing the links between the devices throughout ... Read More

How to use SharedPreferences on Android to store, read and edit values using Kotlin?

Azhar
Updated on 01-Dec-2020 05:19:24

204 Views

This example demonstrates how to use SharedPreferences on Android to store, read and edit values 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.SharedPreferences import android.os.Bundle import android.view.View import android.widget.EditText import android.widget.TextView import android.widget.Toast import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() {    lateinit var editTextName: EditText    private lateinit ... Read More

How to pass data between Activities on an Android application using Kotlin?

Azhar
Updated on 01-Dec-2020 05:14:26

326 Views

This example demonstrates how to pass data between Activities on an 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 − Add the following code to src/MainActivity.ktimport android.content.Intent import android.os.Bundle import android.widget.Button import android.widget.TextView import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() {    private val myRequestCode = 1    override fun onCreate(savedInstanceState: Bundle?) {       super.onCreate(savedInstanceState)       setContentView(R.layout.activity_main) ... Read More

How to parse JSON on Android using Kotlin?

Azhar
Updated on 19-Aug-2022 09:04:56

4K+ Views

This example demonstrates how to parse JSON on 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.os.Bundle import android.widget.TextView import androidx.appcompat.app.AppCompatActivity import org.json.JSONException import org.json.JSONObject class MainActivity : AppCompatActivity() {    lateinit var textViewName: TextView    lateinit var textViewSal: TextView    var jsonString = "{"employee":{"name":"tutorialspoint", "salary":65000}}"    lateinit var name:String    lateinit var salary:String    override ... Read More

How to call OnDestroy Activity in an Android App using Kotlin?

Azhar
Updated on 01-Dec-2020 05:03:52

1K+ Views

This example demonstrates how to call OnDestroy Activity 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.util.Log import android.widget.Toast import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() {    private val myTag = "Destroy"    override fun onCreate(savedInstanceState: Bundle?) {       super.onCreate(savedInstanceState)       setContentView(R.layout.activity_main)       title = "KotlinApp"   ... Read More

How to get the current date and time from the internet in Android using Kotlin?

Azhar
Updated on 01-Dec-2020 05:01:02

516 Views

This example demonstrates how to get the current date and time from the internet 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 java.text.SimpleDateFormat import java.util.* class MainActivity : AppCompatActivity() {    lateinit var calendar: Calendar    lateinit var simpleDateFormat: SimpleDateFormat    lateinit var date: String    lateinit ... Read More

How to write files to the assets folder in android using Kotlin?

Azhar
Updated on 01-Dec-2020 04:58:07

967 Views

This example demonstrates how to write files to the assets folder 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 java.io.IOException import java.io.InputStream class MainActivity : AppCompatActivity() {    lateinit var textView: TextView    lateinit var button: Button    override fun onCreate(savedInstanceState: Bundle?) {       super.onCreate(savedInstanceState) ... Read More

Where and how to use static variables in Android using Kotlin?

Azhar
Updated on 30-Nov-2020 13:19:29

407 Views

This example demonstrates how to use static variables 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.util.Log import android.widget.Toast import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() {    private val tag = "I'm a Static Variable"    override fun onCreate(savedInstanceState: Bundle?) {       super.onCreate(savedInstanceState)       setContentView(R.layout.activity_main)       title = "KotlinApp" ... Read More

How to send a variable from Activity to Fragment in Android using Kotlin?

Azhar
Updated on 30-Nov-2020 13:15:36

2K+ Views

This example demonstrates how to send a variable from Activity to Fragment 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.EditText import androidx.appcompat.app.AppCompatActivity import androidx.fragment.app.FragmentManager import androidx.fragment.app.FragmentTransaction class MainActivity : AppCompatActivity() {    lateinit var editText: EditText    lateinit var button: Button    override fun onCreate(savedInstanceState: Bundle?) {   ... Read More

How to Change color of Button in Android when Clicked using Kotlin?

Azhar
Updated on 30-Nov-2020 13:11:15

2K+ Views

This example demonstrates how to Change color of Button in Android when Clicked 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.graphics.Color import android.os.Bundle import android.widget.Button import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() {    override fun onCreate(savedInstanceState: Bundle?) {       super.onCreate(savedInstanceState)       setContentView(R.layout.activity_main)       title = "KotlinApp"       val button: Button ... Read More

Advertisements