Skip to content

BitmapUtils.getBitmap not working #3

@vallemar

Description

@vallemar

I am using the camera plugin but I have some problem using BitmapUtils.getBitmap, I am using it with the following example, if I remove this the process runs without problems

useEventListener(cameraView, {
  loaded() {
    cameraView.value.processor =
      new com.nativescript.cameraview.ImageAnalysisCallback({
        process: (image, info, processor) => {
          var previewBitmap = com.nativescript.cameraview.BitmapUtils.getBitmap(
            Utils.android.getApplicationContext(),
            image
          );

          processor.finished();
        },
      });
  },
});

Method reference: https://github.com/nativescript-community/ui-cameraview/blob/main/packages/ui-cameraview/platforms/android/java/com/nativescript/cameraview/BitmapUtils.kt#L104

Error:

  System.err: An uncaught Exception occurred on "main" thread.
  System.err: Calling js method process failed
  System.err: TypeError: com.nativescript.cameraview.BitmapUtils.getBitmap is not a function
  System.err:
  System.err: StackTrace:
  System.err: process(file: src/webpack:/com.vallemar.fly/src/views/JoinActivity.vue:52:70)
  System.err:   at com.tns.Runtime.callJSMethodNative(Native Method)
  System.err:   at com.tns.Runtime.access$2200(Runtime.java:39)
  System.err:   at com.tns.Runtime$5.run(Runtime.java:1323)
  System.err:   at android.os.Handler.handleCallback(Handler.java:958)
  System.err:   at android.os.Handler.dispatchMessage(Handler.java:99)
  System.err:   at android.os.Looper.loopOnce(Looper.java:224)
  System.err:   at android.os.Looper.loop(Looper.java:318)
  System.err:   at android.app.ActivityThread.main(ActivityThread.java:8772)
  System.err:   at java.lang.reflect.Method.invoke(Native Method)
  System.err:   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:561)
  System.err:   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1013)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions