コード例 #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Log.d(TAG, "ABI=" + Build.CPU_ABI);
    Log.d(TAG, "PRODUCT=" + Build.PRODUCT);
    Log.d(TAG, "MANUFACTURER=" + Build.MANUFACTURER);
    Log.d(TAG, "MODEL=" + Build.MODEL);
    Log.d(TAG, "DEVICE=" + Build.DEVICE);
    Log.d(TAG, "BOARD=" + Build.BOARD);
    Log.d(TAG, "FINGERPRINT=" + Build.FINGERPRINT);

    if (!Loader.loaded) {
      TextView tv = new TextView(this);
      tv.setText(
          "Failed to load the native XCSoar libary.\n"
              + "Report this problem to us, and include the following information:\n"
              + "ABI="
              + Build.CPU_ABI
              + "\n"
              + "PRODUCT="
              + Build.PRODUCT
              + "\n"
              + "FINGERPRINT="
              + Build.FINGERPRINT
              + "\n"
              + "error="
              + Loader.error);
      setContentView(tv);
      return;
    }

    Timer.Initialize();
    InternalGPS.Initialize();

    try {
      BluetoothHelper.Initialize();
    } catch (VerifyError e) {
      // Android < 2.0 doesn't have Bluetooth support
    }

    // fullscreen mode
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow()
        .addFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN
                | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

    TextView tv = new TextView(this);
    tv.setText("Loading XCSoar...");
    setContentView(tv);

    registerReceiver(batteryReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
  }
コード例 #2
0
  @Override
  protected void initViewData() {
    defaultAdapter = BluetoothHelper.getDefaultAdapter(this);
    if (defaultAdapter != null) {
      // 已经匹配过的设备
      final Set<BluetoothDevice> bondedDevices = defaultAdapter.getBondedDevices();
      for (BluetoothDevice device : bondedDevices) {
        rightAdapter.addLastItem(new BluetoothDeviceBean(device));
      }
    }
    log.info("initViewData");

    BluetoothDiscover.instance().addDiscoverListener(this);
  }