From: Mikko Rasa Date: Sun, 19 Oct 2014 17:23:02 +0000 (+0300) Subject: Expose the asset manager from Android::MainThread X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=c0d3fd58fd25e4627a6f8d64a22c5800e783ce07;p=libs%2Fcore.git Expose the asset manager from Android::MainThread AFAICT the asset manager is tied to the application and not the activity, so this simple approach should be safe even if the activity gets destroyed and recreated due to orientation change or whatever. --- diff --git a/source/core/android/mainthread.cpp b/source/core/android/mainthread.cpp index 1e5fc11..6a3f865 100644 --- a/source/core/android/mainthread.cpp +++ b/source/core/android/mainthread.cpp @@ -10,6 +10,7 @@ namespace Msp { namespace Android { MainThread::MainThread(ANativeActivity *a): + asset_manager(a->assetManager), starting_up(true) { attach_to_activity(a); diff --git a/source/core/android/mainthread.h b/source/core/android/mainthread.h index 68da6c4..efd0fe0 100644 --- a/source/core/android/mainthread.h +++ b/source/core/android/mainthread.h @@ -20,6 +20,7 @@ public: private: ANativeActivity *activity; + AAssetManager *asset_manager; bool starting_up; Mutex startup_mutex; @@ -31,6 +32,8 @@ public: void wait_for_app_created(); void resume_startup(); + AAssetManager *get_asset_manager() const { return asset_manager; } + private: virtual void main();