Android反射调用hide方法

http://blog.csdn.net/annkie/article/details/8466654

public void a2dpConnect(BluetoothDevice device) {
		Logg.i(SPPService.TAG, "a2dpConnect");
		if (a2dpProfile != null && device != null && a2dpProfile.getConnectionState(device) == BluetoothProfile.STATE_DISCONNECTED) {
			BluetoothA2dp a2dp = (BluetoothA2dp) a2dpProfile;
			a2dp.isA2dpPlaying(device);
			Class clazz = a2dp.getClass();
			Method m2;
			try {
				m2 = clazz.getMethod("connect", BluetoothDevice.class);
				m2.invoke(a2dp, device);
			} catch (Exception e) {
				e.printStackTrace();
				Logg.i(SPPService.TAG, "error:----" + e.getMessage());
			}
			Logg.i(SPPService.TAG, "a2dp disconnect--》");
		}

	}


你可能感兴趣的:(菜鸟级别)