Barcode Scanning in Android Using Kotlin

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

3K+ Views

This example demonstrates how to implement bar code scanning 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 the dependency to build.gradle (Module:app)implementation 'com.google.zxing:core:3.3.3' implementation 'com.journeyapps:zxing-android-embedded:3.2.0@aar'Step 4 − Add the following code to src/MainActivity.ktExampleimport android.content.Intent import android.os.Bundle import android.util.Log import android.widget.Button import android.widget.TextView import android.widget.Toast import androidx.appcompat.app.AppCompatActivity import com.google.zxing.integration.android.IntentIntegrator class MainActivity : AppCompatActivity() {    lateinit var btnBarcode: Button    lateinit var textView: ... Read More

Set All Background Properties in One Declaration with JavaScript DOM

Swarali Sree
Updated on 23-May-2020 11:41:14

154 Views

To set the background in JavaScript, use the background property. It allows you to set the background color, image, position, etc.ExampleYou can try to run the following code to learn how to set all the background properties in a single declaration with JavaScript.Live Demo           Click to Set background                function display() {             document.body.style.background = "url('https://www.tutorialspoint.com/html5/images/html5-mini-logo.jpg') repeat right top";          }          

Automatically Start and Stop an Async Task in Kotlin

Azhar
Updated on 23-May-2020 11:37:22

372 Views

This example demonstrates how to automatically start and stop an Async task 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.os.AsyncTask import android.os.Bundle import android.view.View import android.widget.Toast import androidx.appcompat.app.AppCompatActivity import kotlinx.android.synthetic.main.activity_main.* import java.lang.ref.WeakReference class MainActivity : AppCompatActivity() {    var variable = 10    override fun onCreate(savedInstanceState: Bundle?) {       super.onCreate(savedInstanceState)       setContentView(R.layout.activity_main)     ... Read More

Search and Display Pathname of Href Attribute in JavaScript

Vrundesha Joshi
Updated on 23-May-2020 11:37:05

172 Views

To get the pathname part of the href attribute of an area in JavaScript, use the pathname property.ExampleYou can try to run the following code to display the pathname part.                                                var x = document.getElementById("myarea").pathname;          document.write("Pathname: "+x);          

Stop AsyncTask Thread in Kotlin

Azhar
Updated on 23-May-2020 11:27:11

795 Views

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

Search Alternate Text of Image Map Area in JavaScript

Sravani S
Updated on 23-May-2020 11:22:37

181 Views

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

Search Value of Type Attribute of a Link in JavaScript

Jennifer Nicholas
Updated on 23-May-2020 11:22:09

224 Views

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

Search Value of Target Attribute of a Link in JavaScript

Nikitha N
Updated on 23-May-2020 11:21:40

372 Views

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

Android SlidingDrawer Slide Out from the Left in Kotlin

Azhar
Updated on 23-May-2020 11:15:34

190 Views

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

Get List of Installed Android Applications in Kotlin

Azhar
Updated on 23-May-2020 11:08:59

2K+ Views

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

Advertisements