나는 자바 코드로로드하는 두 개의 라이브러리 (.so)를 가지고있다.네이티브 활동을 사용하는 방법? 전통적인 활동과 결합 될 수 있습니까?
그러나 Java (활동) < -> C++ (. so 파일) 호출이 필요한 몇 가지 특정 작업이 있습니다.
네이티브 액티비티를 사용하여 해당 기능의 일부를 구현할 수 있습니까? 네이티브 액티비티는 전통적인 액티비티에 추가적으로 필요한 것입니까, 아니면 선택해야합니까? 어떤 액티비티를 사용할 것입니까?
[편집] native activity
안드로이드 NDK/소스/안드로이드/native_app_glue/android_native_app_glue.h
에 의해 네이티브 코드로 처리 할 수있는 이벤트 집합이enum {
/**
* Command from main thread: the AInputQueue has changed. Upon processing
* this command, android_app->inputQueue will be updated to the new queue
* (or NULL).
*/
APP_CMD_INPUT_CHANGED,
/**
* Command from main thread: a new ANativeWindow is ready for use. Upon
* receiving this command, android_app->window will contain the new window
* surface.
*/
APP_CMD_INIT_WINDOW,
/**
* Command from main thread: the existing ANativeWindow needs to be
* terminated. Upon receiving this command, android_app->window still
* contains the existing window; after calling android_app_exec_cmd
* it will be set to NULL.
*/
APP_CMD_TERM_WINDOW,
/**
* Command from main thread: the current ANativeWindow has been resized.
* Please redraw with its new size.
*/
APP_CMD_WINDOW_RESIZED,
/**
* Command from main thread: the system needs that the current ANativeWindow
* be redrawn. You should redraw the window before handing this to
* android_app_exec_cmd() in order to avoid transient drawing glitches.
*/
APP_CMD_WINDOW_REDRAW_NEEDED,
/**
* Command from main thread: the content area of the window has changed,
* such as from the soft input window being shown or hidden. You can
* find the new content rect in android_app::contentRect.
*/
APP_CMD_CONTENT_RECT_CHANGED,
/**
* Command from main thread: the app's activity window has gained
* input focus.
*/
APP_CMD_GAINED_FOCUS,
/**
* Command from main thread: the app's activity window has lost
* input focus.
*/
APP_CMD_LOST_FOCUS,
/**
* Command from main thread: the current device configuration has changed.
*/
APP_CMD_CONFIG_CHANGED,
/**
* Command from main thread: the system is running low on memory.
* Try to reduce your memory use.
*/
APP_CMD_LOW_MEMORY,
/**
* Command from main thread: the app's activity has been started.
*/
APP_CMD_START,
/**
* Command from main thread: the app's activity has been resumed.
*/
APP_CMD_RESUME,
/**
* Command from main thread: the app should generate a new saved state
* for itself, to restore from later if needed. If you have saved state,
* allocate it with malloc and place it in android_app.savedState with
* the size in android_app.savedStateSize. The will be freed for you
* later.
*/
APP_CMD_SAVE_STATE,
/**
* Command from main thread: the app's activity has been paused.
*/
APP_CMD_PAUSE,
/**
* Command from main thread: the app's activity has been stopped.
*/
APP_CMD_STOP,
/**
* Command from main thread: the app's activity is being destroyed,
* and waiting for the app thread to clean up and exit before proceeding.
*/
APP_CMD_DESTROY,
};
내가 특정 이벤트 이후에 호출해야하는 코드의 일부가 C++로 작성되었으므로, 더 좋을 것이라고 생각합니다. 네이티브 액티비티를 통해 C++에서이를 처리합니다. 그러나 자바에서 이벤트를 처리 한 후에 호출해야하는 코드도 있습니다.
질문은 ... 내 활동의 기본 버전 (기본 인터페이스)을 가질 수 있으며, 동일한 이벤트에서 이와 동일한 활동을 수행하는 데 도움이 될 수 있습니까?
@noisy 네 문제는 "두 개의 기본 라이브러리를로드 할 수 없다"입니다. 제가 맞습니까? – 100rabh