Role of parseFloat Method in JavaScript

Priya Pallavi
Updated on 23-May-2020 11:04:59

219 Views

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);          

Make ImageView with Rounded Corners on Android App using Kotlin

Azhar
Updated on 23-May-2020 11:04:20

1K+ Views

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

Role of parseInt Method in JavaScript

Smita Kapse
Updated on 23-May-2020 11:04:04

284 Views

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);          

What Happens When a Value is Converted to Boolean in JavaScript

Sharon Christine
Updated on 23-May-2020 11:02:51

124 Views

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));          

Role of Keyboard Event altKey Property in JavaScript

Daniol Thomas
Updated on 23-May-2020 11:00:45

182 Views

The altkey property is used to show whether ALT key is pressed or not when key event was triggered.ExampleYou can try to run the following code to learn how to implement altKey property in JavaScript.                 Press any key                function funcAltKey(event) {             var val = document.getElementById("res");                         if (event.altKey) {                val.innerHTML = "ALT key: Pressed";             } else {                val.innerHTML = "ALT key: NOT Pressed";             }          }          

Usage of copyWithin Method in JavaScript

Nikitha N
Updated on 23-May-2020 11:00:01

202 Views

Use the copyWithin() method in JavaScript to copy array elements. You can set the index from/to where (index) the elements are copied. The following are the elements supported by JavaScript.target − The position of the index from where the elements is to be copied.begin − The index to start copying the element. This is an optional parameter.end − The index to end copying the element. This is an optional parameter.ExampleYou can try to run the following code to learn how to work with copyWithin() method in JavaScript.                    var num ... Read More

Enable or Disable GPS Programmatically on Kotlin

Azhar
Updated on 23-May-2020 10:59:06

2K+ Views

This example demonstrates how to enable or disable the GPS programmatically on 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 &minsu; Add the following code to res/layout/activity_main.xml.Example             Step 3 − Add the following code to src/MainActivity.ktimport android.content.Context import android.content.Intent import android.location.LocationManager import android.os.Bundle import android.provider.Settings import android.view.View import android.widget.TextView import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() {    private lateinit var context: Context    var intent1: Intent? = null    lateinit var textView: TextView   ... Read More

Load Image by URL using Picasso Library in Kotlin

Azhar
Updated on 23-May-2020 10:50:48

2K+ Views

This example demonstrates how to create a WebView 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.Example             Step 3 − Add the following dependency to build.gradle(Module:app)implementation 'com.squareup.picasso:picasso:2.5.2'Step 4 − Add the following code to src/MainActivity.ktExampleimport android.os.Bundle import android.widget.ImageView import androidx.appcompat.app.AppCompatActivity import com.squareup.picasso.Picasso class MainActivity : AppCompatActivity() {    override fun onCreate(savedInstanceState: Bundle?) {       super.onCreate(savedInstanceState)       setContentView(R.layout.activity_main)       ... Read More

Create ListView with Checkbox in Kotlin

Azhar
Updated on 23-May-2020 10:44:43

1K+ Views

This example demonstrates how to Create a listView with a checkBox 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.view.View import android.widget.AdapterView.OnItemClickListener import android.widget.ListView import androidx.appcompat.app.AppCompatActivity import java.util.* class MainActivity : AppCompatActivity() {    private var dataModel: ArrayList? = null    private lateinit var listView: ListView    private lateinit var adapter: CustomAdapter    override fun onCreate(savedInstanceState: Bundle?) {       super.onCreate(savedInstanceState) ... Read More

Create WebView in an Android App using Kotlin

Azhar
Updated on 23-May-2020 10:43:11

2K+ Views

This example demonstrates how to create a WebView 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.Example         Step 3 − Add the following code to src/MainActivity.ktExampleimport android.os.Bundle import android.webkit.WebView import android.webkit.WebViewClient import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() {    private val webView: WebView? = null    override fun onCreate(savedInstanceState: Bundle?) {       super.onCreate(savedInstanceState)       setContentView(R.layout.activity_main)       title = "KotlinApp"       val webView = findViewById(R.id.webView)       ... Read More

Advertisements