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 8252057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T00:26:27+00:00 2026-06-08T00:26:27+00:00

I am new in the Android programming world and I have already made a

  • 0

I am new in the Android programming world and I have already made a full search on the Internet about the JNI implementation in Android. By the way, there are lots of ways to do it, and I don’t find too much documentation about DSP in C/C++ for Android.

I have already got the audio data from a recording (PCM to float), and I would like to send the data to a C/C++ function to process this data. After the transformation I would like to return the array to the Java activity to playback the result. Is there any simple example or documentation about sending and receiving arrays with the JNI?

I am using Windows 7, Eclipse and Cygwin.

Thank you in advance

  • 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-06-08T00:26:29+00:00Added an answer on June 8, 2026 at 12:26 am

    Should be quite simple,

    To transfer a byteArray from Java to C++ you can consider the following example :

    Step 1: in the java class which will call the native method declare the method (in my example a simple zip)

    private native byte[] jniZipString(byte[] unpackedData, int datasize);
    

    Step 2: in c++ generate the header and implementation using javah.exe
    [note] call javah from the bin/classes foler (since your coding for android

    javah -jni com.example.JavaClassWithNativeMethods
    

    Step 3: in C++ receive the byte array and covert to C++ bytearray

    jbyte* tempPointer = env->GetByteArrayElements(jInput, 0);
    const char* cinput = (const char*) tempPointer;
    int dataSize = (int)env->GetArrayLength(jInput)
    

    Step 4: in process your data

    whatever you do to process the bytearray
    

    Step 5: return the resulting byte array to java

    jbyteArray result = (env)->NewByteArray(newDataSize);
    (env)->SetByteArrayRegion(result, 0, newDataSize, (jbyte *) processedCharArray); 
    return result;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to Android programming, so I'm facing some general problems about choosing the
I have just began opengl programming in android and i am fairly new to
I am very new to Android programming, and I have read everywhere and I
I'm new to Android programming however I do have some Java experience. What I
I'm very new to programming in Android, but have been struggling all day with
I'm fairly new to Android programming and to Java in general, but I have
So I'm fairly new to Android Development and Programming in general... I have a
I'm trying to make an android app (I'm new in the Android programming world),
I'm new to Java programming, I am programming Java 1.6 with Android. I have
I am new to Android/java programming. I really have no clue what I am

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.