コード例 #1
0
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
    Log.d(
        TAG,
        "onActivityResult. requestCode: "
            + requestCode
            + " resultCode: "
            + resultCode
            + " data: "
            + data);
    Uri uri = data.getData();
    if (null == uri) {
      return;
    }

    String path = uri.toString();
    if (!TextUtils.isEmpty(path)) {
      try {
        if (path.startsWith("file:///")) {
          path = path.substring("file://".length());
        }
        Log.d(TAG, "path: " + path);

        FelixWrapper.getInstance(this)
            .getFramework()
            .getBundleContext()
            .installBundle(path, new FileInputStream(new File(path)));
        updateUI();
      } catch (BundleException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (FileNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
    super.onActivityResult(requestCode, resultCode, data);
  }
コード例 #2
0
 private void syncWithOsgi() {
   Framework f = FelixWrapper.getInstance(null).getFramework();
   mBundles = f.getBundleContext().getBundles();
 }