Facing ARN issue even though intent called inside the thread

20 Views Asked by At

On button click, I am trying to trigger the intent call, it takes place almost 2 to 3 mins. So, I am showing a progress bar on the screen.

 activityBinding.btnDeviceStatus.setOnClickListener {
        activityBinding.progressBlock.visibility = View.VISIBLE
        Thread(Runnable {
      
           try {
              startActivityForResult(configIntent, intentRequest)

           } catch (e: InterruptedException) {
            e.printStackTrace()
            runOnUiThread {
                activityBinding.pairLogs.visibility = View.VISIBLE
                activityBinding.pairLogs.text = DeviceStatus.NotAvailable.toString()
                activityBinding.buttnRow.visibility = View.VISIBLE
                activityBinding.progressBlock.visibility = View.GONE
            }
        }

        }).start()
    }
   

Facing a few issues as below

  1. The progress bar is visible but the screen has been frozen some times after that only the progress bar started rotating.

  2. Even though I called the intent inside the separate thread, I am facing an ARN issue.

0

There are 0 best solutions below