BluetoothDeviceStubFactory.java :  » Blog-Twitter » droidsensor » com » example » bluetooth » Android Open Source

Android Open Source » Blog Twitter » droidsensor 
droidsensor » com » example » bluetooth » BluetoothDeviceStubFactory.java
package com.example.bluetooth;

import android.content.Context;

public abstract class BluetoothDeviceStubFactory {

  private static final String SERVICE_NAME = "bluetooth";

  private static BluetoothDeviceStub CACHED_INSTANCE;

  public static synchronized BluetoothDeviceStub createBluetoothDeviceStub(
      Context context) {

    if (CACHED_INSTANCE != null) {

      return CACHED_INSTANCE;
    }

    Object bluetoothService = context.getSystemService(SERVICE_NAME);
    BluetoothDeviceStub res = DelegatingProxyFactory.createProxy(
        BluetoothDeviceStub.class, bluetoothService);

    if (CACHED_INSTANCE == null) {

      CACHED_INSTANCE = res;
    }

    return res;
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.