Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6708363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:45:00+00:00 2026-05-26T07:45:00+00:00

In the Android JNI binding, you can expose a Java method such as method(int[]

  • 0

In the Android JNI binding, you can expose a Java method such as method(int[] intArray) {} to JavaScript, pass it a JavaScript array, and expect the binding to convert that JavaScript array to int[]. Does Android have the same handling for e.g. Uint8Array()?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T07:45:01+00:00Added an answer on May 26, 2026 at 7:45 am

    The JavaScript engine that runs in Android’s WebView does not support Uint8Arrays, or any of the other typed arrays (as of 2.3.3).

    EDIT: I did some more testing with the simulators and I have mixed things to report.

    On the plus side, the JavaScript engine in Android 3.x’s WebView does support typed arrays, with the exception of Float64Array.

    On the minus side, the JNI interface to Java via WebView.addJavascriptInterface() does not convert the types at all. This is the code I used to test it:

    var u8arr = new Uint8Array(4);
    u8arr.set([2, 3, 5, 7]);
    android.log(u8arr);
    

    And the Java function for android.log() looks basically like this:

    public void log(final int[] data) {
        final String dataInfo = (data == null) ? "NULL" : "[" + data.length + "]";
        Log.d("JsJni", "data=" + dataInfo);
        /* ... */
    }
    

    When I called android.log with standard Array() type JavaScript object, I’d get the results one would expect (the array bound to data, type conversion, etc…) When android.log was called with the Uint8Array object (or any of the other typed arrays, for that matter, including Int8Array, Int16Array, and Int32Array), data is null.

    It’s the same between Android 3.0 and 3.2

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to return array of string from JNI to java(actully in android). How
I want to call a non-static method on Android using JNI. I can call
I want to use DTLS (on OpenSSL) using JNI on Android 2.1/2.2. Can someone
Does Java pass by reference or value to C when using JNI ( more
I'm currently using SWIG/jni to call C++ functions from java for an Android app.
I'm testing some functions with Android, JNI and NDK. I have the following JAVA
I'm new in Android JNI. I'm sending JAVA object from my java file to
Android is based on Linux; can native Linux applications be run on Android?
Android comes with lots of system resources ( android.R ) that can be used
Is Android development restrictive in any way like the iPhone , or can you

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.