activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<layout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Dialogs example"
/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/bt4"
android:text="Progress Dialog"/>
</LinearLayout>
</layout>
MainActivity.kt
package com.androindian.dialogsex
import android.app.Dialog
import android.app.ProgressDialog
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Button
import android.widget.Toast
import androidx.appcompat.app.AlertDialog
import androidx.databinding.DataBindingUtil
import com.androindian.dialogsex.databinding.ActivityMainBinding
import com.google.android.material.transition.MaterialContainerTransform.ProgressThresholds
class MainActivity : AppCompatActivity() {
var binding:ActivityMainBinding?=null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding= DataBindingUtil.setContentView(this,R.layout.activity_main)
binding?.bt4?.setOnClickListener{
var progressdialog=ProgressDialog(this)
progressdialog.setTitle("please wait ")
progressdialog.setMessage("Content Loading")
progressdialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL)
progressdialog.show()
}
}
}