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

  • Home
  • SEARCH
  • 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 8016667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:36:10+00:00 2026-06-04T20:36:10+00:00

I have a android project and within that project I have a folder that

  • 0

I have a android project and within that project I have a folder that contain some images.Now what i want is to access that folder within a jni function. So how should I do that?

  • 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-04T20:36:12+00:00Added an answer on June 4, 2026 at 8:36 pm

    An Android application is essentially a zip file, but there are a lot of nice helpers to get to those resources. First thing you need to remember is that these files are not actually in a folder, unless you put them there.

    That said, there are a number of possible solutions for you situation.

    JNI (almost) all the way

    The most JNI-y way to go about things is to use have a method like

    private native void processResources(AssetManager assets);
    

    in your Activity, and use JNI to pry all the necessary resources from it, put them somewhere on disk, and process them.

    Mix in a bit of Java

    Probably an easier way is to have some Java code that helps with the resource management; something like

    private void processAll() {
        for (String resource : getResources().getAssets().list(mydir)) {
            process(getResources().getAssets().open(resource));
        }
        // exception handling omitted for readability
    }
    
    private void process(InputStream in) throws IOException {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        byte[] buf = new byte[1024];
        for (int read = in.read(buf); read > 0; read = in.read(buf)) {
            out.write(buf, 0, len);
        }
        process(out.toByteArray());
    }
    
    private native void process(byte[] resource);
    

    and do the native processing based on the byte[].

    Prepare files on the file system

    A third solution is to move the files out of your bundle and onto the file system, and then point your native code to that directory.

    So?

    In the end, it all depends on what you exactly want to do with your resources, and whether or not they really need to be on the file system. I would keep things as close to Java as possible, and only go native when you really have to (e.g., your image manipulation code).

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

Sidebar

Related Questions

I have a Android project for SDK1.5 and now I want to convert it
I have a free android app that I want to now distribute as free
I have a problem that I want to reference with another android project, I
I have a Android project with some classes that I would like to compress
I have an Android project that branched into three different applications, app-1 , app-2
I have an Android project in eclipse IDE which was working. After some imports
I have come across a strange error. I have an Android project that uses
I have setup an android test project that runs junit tests. It's using two
In my android project, I have a countdown that randomizes a boolean for an
I have an Android project that depends on an android library (apklib) project. The

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.