- 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 2041 Articles for Mobile Development
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
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
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
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
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
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
588 Views
This example demonstrates how to get all checked items in 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 − Create a java class (CustomAdapter.kt) and the following codepackage app.com.myapplication import android.content.Context import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import android.widget.BaseAdapter import android.widget.CheckBox import android.widget.TextView import android.widget.Toast class CustomAdapter(private val context: Context, private var modelArrayList: ArrayList) : ... Read More
320 Views
This example demonstrates how to listen for volume buttons in Android background service 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.os.Handler import android.provider.Settings import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() { private lateinit var settingsContentObserver: SettingsContentObserver override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) settingsContentObserver ... Read More
2K+ Views
This example demonstrates how to play sound using SoundPool in 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 Android Resource folder (raw) and copy-paste your sound file in the res/raw/filename.mp3 as shown below −Step 4 − Add the following code to src/MainActivity.ktpackage app.com.myapplication import android.media.AudioManager import android.media.SoundPool import android.os.Bundle import android.view.View import android.widget.Toast import androidx.appcompat.app.AppCompatActivity @Suppress("DEPRECATION") class MainActivity : AppCompatActivity() { private var ... Read More
11K+ Views
There are several types of computer and mobile networks to connect world’s digital devices to communicate and share data with each other. These communication technologies provide an efficient way of connecting devices for data sharing and internet access. In this article, we will discuss the major differences between cellular and WiFi networks. The basic difference between the two is that a WiFi network uses micro and radio waves to provide high-speed data transfer among different computing devices, whereas a cellular network uses mobile towers to enable mobile device communication and provide internet access on the device. Other important differences between ... Read More