public DeviceDialog(Context context, Message message) { super(context); mMessage = message; setTitle(Drawables.getWaitDrawable(), "扫描..."); mNetworkDeviceDiscovery = new NetworkDeviceDiscovery(getContext()); mNetworkDeviceDiscovery.setOnDeviceFoundListener(this); mBluetoothDeviceDiscovery = new BluetoothDeviceDiscovery(getContext()); mBluetoothDeviceDiscovery.setOnDeviceFoundListener(this); }
@Override public void onShow() { mNetworkDeviceDiscovery.start(); mBluetoothDeviceDiscovery.start(); }
@Override public void onDismiss() { mNetworkDeviceDiscovery.stop(); mBluetoothDeviceDiscovery.stop(); mMessage.sendToTarget(); }