-6
 override fun itemclick(position: Int) {
        binding.progressbar.visibility=View.VISIBLE
        binding?.barcode?.setImageBitmap(exchngeViewModel.getQrImageBitmap(qrCodeData[position], this!!.activity!!))
        showDetail(position)
        binding.progressbar.visibility=View.GONE
    }    

fun getQrImageBitmap(data: String, context: Context): Bitmap? {
        bitMap = AppUtils.TextToImageEncode(data, context, bus) 
        return this!!.bitMap
    }

This is my code i want to display Progress dialog on item click it should dismiss till that time when getQrImageBitmap and showDetail function completed but i its not working please suggest me how to achieve this how to show and hide detail on item click.Thanks!!

Hemant Parmar
  • 3,924
  • 7
  • 25
  • 49
Maklee Lee
  • 263
  • 5
  • 14

1 Answers1

0

Add Prorgressbar inside showDetail() method

  fun showDetail(position: Int) {
    SharedPreferenceUtils.setExchangePagePostion(this!!.activity!!, position)
    binding?.textHeader?.text = exchangeData[position]
    binding?.backButton?.visibility = View.VISIBLE
    binding?.recyclerView?.visibility = View.GONE
    binding?.barcode?.visibility = View.VISIBLE
    binding?.header1?.setBackgroundResource(R.color.colorOrangeGray)
    binding?.exchangeButton?.visibility = View.VISIBLE


    binding.progressbar.visibility=View.GONE
}
Ramesh sambu
  • 3,577
  • 2
  • 24
  • 39