-2

In my iOS project i kept a binary file and used NSBundle class to access that file.

How do i do that same thing in Android since recently i have started working on Android platform, i wanted to know how do i package and read a binary file in Android app.

I started doing it via native call, created a java wrapper and called a function in cpp file and in that function i am trying to read the binary file.

 File *f = fopen("absolute file path on my laptop", "r") 

Here f is always null whereas in iOS using NSBunle i am able to access the file in my iOS app

Sumit Kumar Saha
  • 799
  • 1
  • 12
  • 25

2 Answers2

1

I passed and assetmanager object from java to NDK end. then called on AAssetManager_fromJava and fetched AAssetManager object on jni layer and used that final object to read the asset.

Sumit Kumar Saha
  • 799
  • 1
  • 12
  • 25
0

Put the file at design time in assets directory.

At run time open an InputStream for the file in assets and read() its bytes.

You can all do in Java. Easy.

greenapps
  • 11,154
  • 2
  • 16
  • 19