Azhar

Azhar

451 Articles Published

Articles by Azhar

Page 30 of 46

How to integrate Facebook using Kotlin?

Azhar
Azhar
Updated on 21-Apr-2020 2K+ Views

This example demonstrates how to integrate Facebook 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 − In your project, open your_app | Gradle Scripts | build.gradle (Module: app) and add the following compile statement to the dependencies{} section to compile the latest version of the SDK −implementation 'com.facebook.android:facebook-login:5.15.3'Step 3 − Add your package name and default activity class name as shown below, click save and continue.Step 4 − Create a Key hash. Based on your operating system you have to copy ...

Read More

How to play videos in Android TextureView using Kotlin?

Azhar
Azhar
Updated on 21-Apr-2020 612 Views

This example demonstrates how to play videos in Android TextureView 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 an asset folder and copy-paste the video into the asset folder.Step 4 − Add the following code to MainActivity.ktimport android.content.res.AssetFileDescriptor import android.graphics.SurfaceTexture import android.media.MediaPlayer import android.media.MediaPlayer.OnVideoSizeChangedListener import android.os.Build import android.os.Bundle import android.view.Surface import android.view.TextureView import android.view.TextureView.SurfaceTextureListener import androidx.appcompat.app.AppCompatActivity import java.io.IOException class MainActivity : AppCompatActivity(), SurfaceTextureListener, OnVideoSizeChangedListener {    private ...

Read More

How to use the TextWatcher class in kotlin?

Azhar
Azhar
Updated on 21-Apr-2020 5K+ Views

This example demonstrates how to use the TextWatcher class 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 − Add the following code to MainActivity.ktimport android.os.Bundle import android.text.Editable import android.text.TextWatcher import android.widget.EditText import android.widget.TextView import android.widget.Toast import androidx.appcompat.app.AppCompatActivity class MainActivity : AppCompatActivity() {    lateinit var input: EditText    lateinit var output: TextView    override fun onCreate(savedInstanceState: Bundle?) {       super.onCreate(savedInstanceState)   ...

Read More

How to create Text to Speech in an Android App using Kotlin?

Azhar
Azhar
Updated on 21-Apr-2020 1K+ Views

This example demonstrates how to create Text to Speech 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.                             Step 3 − Add the following code to MainActivity.ktimport android.app.Activity import android.content.Intent import android.os.Bundle import android.speech.RecognizerIntent import android.widget.ImageView import android.widget.TextView import android.widget.Toast import androidx.appcompat.app.AppCompatActivity import java.util.* import kotlin.collections.ArrayList class MainActivity : AppCompatActivity() {    private val REQUESTCODE = ...

Read More

How to use Date Time Picker Dialog in Kotlin Android?

Azhar
Azhar
Updated on 21-Apr-2020 4K+ Views

This example demonstrates how to use Date Time Picker Dialog in Android 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.app.DatePickerDialog import android.app.TimePickerDialog import android.os.Bundle import android.text.format.DateFormat import android.widget.Button import android.widget.DatePicker import android.widget.TextView import android.widget.TimePicker import androidx.appcompat.app.AppCompatActivity import java.util.* class MainActivity : AppCompatActivity(), DatePickerDialog.OnDateSetListener, TimePickerDialog.OnTimeSetListener {    lateinit var textView: TextView    lateinit var button: Button    var ...

Read More

How to use CheckBox in Android Kotlin?

Azhar
Azhar
Updated on 21-Apr-2020 4K+ Views

This example demonstrates how to use CheckBox in Android 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.Button import android.widget.CheckBox import android.widget.Toast import androidx.appcompat.app.AppCompatActivity import java.lang.StringBuilder class MainActivity : AppCompatActivity() {    lateinit var pizza: CheckBox    lateinit var coffee: CheckBox    lateinit var burger: CheckBox    lateinit var button: Button ...

Read More

Shared Preferences - Save, edit, retrieve, delete in Kotlin?

Azhar
Azhar
Updated on 20-Apr-2020 725 Views

This example demonstrates how Save, edit, retrieve, delete shared preference data 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 − Add the following code to src/MainActivity.ktimport android.content.Context import android.content.SharedPreferences import android.os.Bundle import android.view.View import android.widget.EditText import android.widget.TextView import android.widget.Toast import androidx.appcompat.app.AppCompatActivity @Suppress("NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS") class MainActivity : AppCompatActivity() {    var editTextName: EditText? = ...

Read More

How can I use marquee text in Kotlin?

Azhar
Azhar
Updated on 20-Apr-2020 1K+ Views

This example demonstrates how to use marquee text in an Android Kotlin App.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.widget.TextView class MainActivity : AppCompatActivity() {    override fun onCreate(savedInstanceState: Bundle?) {       super.onCreate(savedInstanceState)       setContentView(R.layout.activity_main)       title = "KotlinApp"       val text: String = "Simple application that shows how ...

Read More

Send data from one Fragment to another using Kotlin?

Azhar
Azhar
Updated on 20-Apr-2020 5K+ Views

This example demonstrates how to send data from one Fragment to another 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 two FragmentActivity and add the codes which are given below.fragmentOne.xml −         FirstFragment.kt −import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.fragment.app.Fragment import kotlinx.android.synthetic.main.fragment_one.view.* class FirstFragment : Fragment() {    private lateinit var communicator: Communicator    override fun onCreateView(       inflater: LayoutInflater, ...

Read More

How to use a simple SQLite database in Kotlin android?

Azhar
Azhar
Updated on 20-Apr-2020 5K+ Views

This example demonstrates how to use a simple SQLite database in 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.                                    

Read More
Showing 291–300 of 451 articles
« Prev 1 28 29 30 31 32 46 Next »
Advertisements