title: Kotlin How to init BluetoothDevice
body: <p>I want to use bluetooth printer in my project, but I got this error</p>
  
  <pre><code>  lateinit property mmDevice has been not initialized
  </code></pre>
  
  <p>This is my code</p>
  
  <pre><code>lateinit var device:String
  lateinit var mBluetoothAdapter: BluetoothAdapter
  lateinit var mmSocket: BluetoothSocket
  lateinit var mmDevice: BluetoothDevice
  
  override fun onCreate(savedInstanceState: Bundle?) {
      super.onCreate(savedInstanceState)
      setContentView(R.layout.activity_penjualan_cetak)
  
      device = Function().getShared("printer","",this)
  
      try {
          findBT()
      } catch (e: Exception) {
  
      }
  }
  
  fun findBT(){
      try{
          mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter()
  
          val paireddevice = mBluetoothAdapter.bondedDevices
  
          if(paireddevice.size &gt; 0){
              ePrinter.setText("Printer Belum Dipilih")
              for (device:BluetoothDevice in paireddevice) {
                  if (device.name == this.device) {
                      // this is the error come from
                      mmDevice = device
                      break
                  }
              }
          }
      }catch (e:Exception){
          e.printStackTrace()
      }
  }
  </code></pre>
  
  <p>How can I init the bluetoothdevice in koltin?, I have tried some solution but it not works</p>