This example demonstrates how to stop an asynctask thread 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.Example Step 3 − Add the following code to src/MainActivity.ktExampleimport android.graphics.Color import android.os.AsyncTask import android.os.Bundle import android.view.View import android.widget.Button import android.widget.TextView import androidx.appcompat.app.AppCompatActivity import java.util.* class MainActivity : AppCompatActivity() { private lateinit var btnDo: Button private lateinit var btnCancel: Button private lateinit var textView: TextView private ... Read More
To search the alternate (alt) text of an image-map area in JavaScript, use the alt property. You can try to run the following code to get the alternate text.Example var x = document.getElementById("myarea").alt; document.write("Alternate Text: "+x);
To search the value of the type attribute of a link in JavaScript, use the type property. You can try to run the following code to get the value of type attribute.Example Qries var x = document.getElementById("qriesid").type; document.write("Value of the type attribute: "+x);
To search the value of the target attribute of a link in JavaScript, use the target property. You can try to run the following code to get the value of target attribute.Example Qries var x = document.getElementById("qriesid").target; document.write("Value of the target attribute: "+x);
ample demonstrates how to make an Android SlidingDrawer slide out from the left 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.Example Step 3 − Add the following code to src/MainActivity.ktExampleimport androidx.appcompat.app.AppCompatActivity import android.os.Bundle class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) title = "KotlinApp" } }Step 4 ... Read More
This example demonstrates how to get a list of installed Android applications 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.Example Step 3 − Add the following code to src/MainActivity.ktExampleimport android.content.pm.ApplicationInfo import android.os.Bundle import android.util.Log import android.widget.ArrayAdapter import android.widget.ListView import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() { lateinit var listView: ListView var arrayAdapter: ArrayAdapter? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) ... Read More
Use the parseFloat() method in JavaScript to return a floating point number after parsing a string.ExampleYou can try to run the following code to learn how to work with parseFloat() method in JavaScript. var val1 = parseFloat("2"); var val2 = parseFloat("30 minutes"); document.write(val1); document.write(""+val2);
This example demonstrates how to make an ImageView with rounded corners on 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.Example Step 3 − Add the following code to src/MainActivity.ktExampleimport android.graphics.* import android.graphics.drawable.BitmapDrawable import android.os.Bundle import android.widget.ImageView import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) title = "KotlinApp" val imageView ... Read More
Use the parseInt() method in JavaScript to return an integer after parsing a string. You can also set the numeral system as a second parameter.ExampleYou can try to run the following code to learn how to work with parseFloat() method in JavaScript. var val1 = parseInt("20.50"); var val2 = parseInt("30 minutes"); var val3 = parseInt("20",16); document.write(val1); document.write(""+val2); document.write(""+val3);
Use the Boolean() method in JavaScript to convert to Boolean. You can try to run the following code to learn how to convert [50, 100] to Boolean in JavaScript.ExampleLive Demo Convert [50,100] to Boolean var myVal = [50,100]; document.write("Boolean: " + Boolean(myVal));
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP