0

I have a button, which onClicked takes to another activity. Now I want the activity to open as bottomDialog. How o do that??

 if (success) {

                val intent = Intent(this, PaymentActivity::class.java)
                intent.putExtra("total_amount",totalAmount)
                startActivity(intent)
                finishAffinity()

              }

I want the PaymentActivity mentioned here to be opened as bottomSheet.

a_local_nobody
  • 7,360
  • 5
  • 25
  • 45
yazhini
  • 47
  • 5

1 Answers1

0

change your Payment Activity to BottomSheetDialogFragment

class PaymentActivity : BottomSheetDialogFragment() {

override fun onCreateView(
    inflater: LayoutInflater, container: ViewGroup?,
    savedInstanceState: Bundle?
): View? {
    return inflater.inflate(R.layout.activity_payment, container, false)
}

}

and you can call it like this,

if (success) {

           val b = PaymentActivity()
        b.show(supportFragmentManager, "Hi")

          }

Add total amount in Bundle.

dennisrufigill
  • 357
  • 1
  • 3
  • 13