Found 1952 Articles for Apps/Applications

How to display progress while loading a url to webview in android?

Azhar
Updated on 30-Nov-2020 04:45:02

748 Views

This example demonstrates how to display progress while loading a url to webview 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.ktimport android.os.Bundle import android.view.View import android.webkit.WebView import android.widget.ProgressBar import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() {    lateinit var webView: WebView    lateinit var progressBar: ProgressBar    override fun onCreate(savedInstanceState: Bundle?) {       super.onCreate(savedInstanceState)       setContentView(R.layout.activity_main) ... Read More

How to use Android Picasso library to download images using Kotlin?

Azhar
Updated on 30-Nov-2020 04:41:35

579 Views

This example demonstrates how to use the Android Picasso library to download images 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.Add the following dependency to the build gradle (Module: app)implementation 'com.squareup.picasso:picasso:2.4.0'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.ImageView import androidx.appcompat.app.AppCompatActivity import com.squareup.picasso.Picasso class MainActivity : AppCompatActivity() {    lateinit var imageView: ImageView    lateinit var btnDownload: Button    override fun onCreate(savedInstanceState: ... Read More

How to create a swipe refresh layout in Android using Kotlin?

Azhar
Updated on 30-Nov-2020 04:33:51

4K+ Views

This example demonstrates how to create a swipe refresh layout 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.os.Handler import android.widget.TextView import androidx.swiperefreshlayout.widget.SwipeRefreshLayout class MainActivity : AppCompatActivity() {    lateinit var swipeRefreshLayout: SwipeRefreshLayout    lateinit var textView: TextView    var number: Int = 0    override fun onCreate(savedInstanceState: Bundle?) {   ... Read More

How to close all Android activities at once using Kotlin?

Azhar
Updated on 30-Nov-2020 04:28:50

1K+ Views

This example demonstrates how to close all Android activities at once 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 com.example.q28 import android.content.Intent import android.os.Bundle 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)       title = ... Read More

How to get the Android Emulator's IP address using Kotlin?

Azhar
Updated on 30-Nov-2020 04:20:53

371 Views

This example demonstrates how to get the Android Emulator's IP address 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.net.wifi.WifiManager import android.os.Bundle import android.widget.Button import android.widget.TextView import androidx.appcompat.app.AppCompatActivity import android.text.format.Formatter class MainActivity : AppCompatActivity() {    lateinit var button: Button    lateinit var textView: TextView    override fun onCreate(savedInstanceState: Bundle?) {       super.onCreate(savedInstanceState)     ... Read More

How to pick an image from an image gallery on Android using Kotlin?

Azhar
Updated on 30-Nov-2020 04:15:19

10K+ Views

This example demonstrates how to pick an image from an image gallery 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.Intent import android.net.Uri import android.os.Bundle import android.provider.MediaStore import android.widget.Button import android.widget.ImageView import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() {    lateinit var imageView: ImageView    lateinit var button: Button    private val pickImage = 100    private var ... Read More

How to create scrollable TextView on Android using Kotlin?

Azhar
Updated on 30-Nov-2020 03:53:23

2K+ Views

This example demonstrates how to create scrollable TextView 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 androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.text.method.ScrollingMovementMethod 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 = findViewById(R.id.textView)   ... Read More

How to create multiple styles inside a TextView on Android using Kotlin?

Azhar
Updated on 30-Nov-2020 03:48:01

871 Views

This example demonstrates how to create multiple styles inside a TextView 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.os.Bundle import android.text.Html import android.widget.TextView import androidx.appcompat.app.AppCompatActivity @Suppress("DEPRECATION") class MainActivity : AppCompatActivity() {    private lateinit var textView: TextView    private lateinit var textView2: TextView    lateinit var textView3: TextView    override fun onCreate(savedInstanceState: Bundle?) { ... Read More

How to parse JSON Objects on Android using Kotlin?

Azhar
Updated on 28-Nov-2020 12:53:28

3K+ Views

This example demonstrates how to parse JSON Objects 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 − Create a new asset folder and create a user_list.json file and the code mentioned below.{    "users":[       {          "name":"Niyaz",          "email":"testemail1@gmail.com",          "contact":{             "mobile":"+91 0000000000"          } ... Read More

How to handle right-to-left and left-to-right swipe gestures on Android using Kotlin?

Azhar
Updated on 28-Nov-2020 12:45:04

1K+ Views

This example demonstrates how to handle right-to-left and left-to-right swipe gestures 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.os.Bundle import android.view.GestureDetector import android.view.MotionEvent import android.widget.Toast import androidx.appcompat.app.AppCompatActivity import kotlin.math.abs class MainActivity : AppCompatActivity(), GestureDetector.OnGestureListener {    lateinit var gestureDetector: GestureDetector    private val swipeThreshold = 100    private val swipeVelocityThreshold = 100    override fun onCreate(savedInstanceState: ... Read More

Advertisements