TimerTask
アクティビティではなく、 (内部で作成されたService
)次のコマンドを使用してデフォルトのBluetoothアダプタを取得しようとしている場合。
BluetoothAdapter.getDefaultAdapter();
次の例外が発生します。
Exception while invoking java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
私のアプリケーションにはアクティビティがありません-このアダプタをアクティビティから削除する可能性はありますか?