BluetoothAdapter.isDiscoveringで、Bluetooth機器の探索中かどうかをチェック出来る。
BluetoothAdapter | Android Developers
strings.xmlで、
Button2を追加。
activity_main.xmlで、
こちらも"Button2"と表示されるbutton2が追加。
MainActivity.javaで、
button2が押されたら、mBluetoothAdapter.isDiscoveringで探索中かそうでないかをチェックする。
![起動時](https://cdn-ak.f.st-hatena.com/images/fotolife/B/BG1/20201227/20201227150924.png)
起動時。
この状態でButton2を押した場合、
![探索されていない](https://cdn-ak.f.st-hatena.com/images/fotolife/B/BG1/20201227/20201227151032.png)
探索されていない。
Button1を押すと、
![今回OFFの状態にしてたので許可を押す](https://cdn-ak.f.st-hatena.com/images/fotolife/B/BG1/20201227/20201227151112.png)
今回OFFの状態にしてたので許可を押す。
そしてButton1を押して探索しているところでButton2を押すと、
![探索中となる](https://cdn-ak.f.st-hatena.com/images/fotolife/B/BG1/20201227/20201227151344.png)
探索中となる。
でしばらく経ってから、Button2を押すと、
![既に探索は終わっているので、こうなる。](https://cdn-ak.f.st-hatena.com/images/fotolife/B/BG1/20201227/20201227151555.png)
既に探索は終わっているので、こうなる。