Hi again,
Thanks for the responses, we were able to get it working based on your
feedback!
We ran into some issues using the AAssetManager's API though so I
thought I should update this post.
Background:
We're using uncompressed assets (via <nocompress /> flag within the
build.xml file)
We're porting from IOS/OSX/Windows (all file access was done via
stdlib calls on a FILE pointer fseek,fopen, etc)
We're not using the Eclipse environment.
Problems:
We wrapped up all file access into a custom class which uses the
AAssetManager's API for Android builds.
We pass the AAssetManager provided by the NDK to this system.
At first we used the corresponding AAssetManager API calls directly
(AAsset_read, AAsset_seek, AAsset_getLength) etc.
However we got mixed results, files were not loading 100%.
Turns out we were confused over AAsset_getLength -we expected it to
work like ftell.
However it seems that a combination of AAsset_getLength and
AAsset_getRemainingLength would be required to simulate ftell's
behaviour?
Solution:
The solution we came up with was to use AAssetManager's API to obtain
access to the File Descriptor, starting offset and length
Then we perform all operations using stdlib's API on that file
descriptor.
We make sure to use AAsset_open and AAsset_close in addition to fdopen
and fclose
Suggestion:
In our experience we think that the NDK could benefit by adding
AAsset_tell to the AAssetManager's API so that it could be a 1 to 1
solution to stdlib.
Of course more documentation on the API would have saved us time as
well =]
Cheers,
Chris
On Apr 5, 1:30 pm, Dianne Hackborn <
hack...@android.com> wrote:
> The official way is with the APIs in asset_manager.h. Use NativeActivity,
> that has the AAssetManager for your application in its 'assetManager'
> field, and you can use the asset_manager.h functions to iterate, open and
> read the contents.
>
> On Thu, Apr 5, 2012 at 2:02 AM, Chris Perry
> <
chris.pe...@muyinteractive.com>wrote:
>
hack...@android.com