native-activity

Obtaining the name of an Android APK using C++ and the NativeActivity class

五迷三道 提交于 2019-12-01 06:47:30
问题 I'm writing an Android app using the NDK and NativeActivity. My app depends on a few bits of third party code that are shipped as assets. Currently I'm working on trying to extract those assets while keeping the folder structure intact. I've tried using the AssetManager, but to keep the folder structure intact it seemed like there would a huge amount of code involved, for a simple task such as what I've mentioned. I've since switched focus to try to implement treating the APK as a ZIP file

FrameBuffers with GLSurfaceView pattern in OpenGLES 1.1 on android ndk

我是研究僧i 提交于 2019-11-30 23:43:01
in Android NDK, is it possible to make OpenGL ES 1.1 work with the typical java-side GLSurfaceView pattern (overriding methods from GLSurfaceView.Renderer onDrawFrame, onSurfaceCreated, etc.) while using in the C++ side the frame, color and depth buffers, and VBO? I am trying to create them using this: void ES1Renderer::on_surface_created() { // Create default framebuffer object. The backing will be allocated for the current layer in -resizeFromLayer glGenFramebuffersOES(1, &defaultFramebuffer); glBindFramebufferOES(GL_FRAMEBUFFER_OES, defaultFramebuffer); // Create color renderbuffer object.

FrameBuffers with GLSurfaceView pattern in OpenGLES 1.1 on android ndk

Deadly 提交于 2019-11-30 17:26:09
问题 in Android NDK, is it possible to make OpenGL ES 1.1 work with the typical java-side GLSurfaceView pattern (overriding methods from GLSurfaceView.Renderer onDrawFrame, onSurfaceCreated, etc.) while using in the C++ side the frame, color and depth buffers, and VBO? I am trying to create them using this: void ES1Renderer::on_surface_created() { // Create default framebuffer object. The backing will be allocated for the current layer in -resizeFromLayer glGenFramebuffersOES(1,

How do I write to the internal storage file system with NativeActivity?

家住魔仙堡 提交于 2019-11-30 16:20:05
I'm porting a pure C++ game over to Android, and since my target is Android 3.0+ tablets, I opted to use NativeActivity in order to avoid Java completely. However, I am not able to see any functionality that lets me write to the device's internal storage. Calls to fopen() will fail as I have no idea which directory I am supposed to write and the internal storage filesystem is not accessible This code usually does the trick on Java, giving me the path to the internal writable data directory for my app: mContext.getFilesDir(); Does anybody know an alternative for C++? Otherwise I'll have to call

Keyboard input in android NDK using NativeActivity

こ雲淡風輕ζ 提交于 2019-11-30 14:38:54
I'm looking for a way of getting input from the software keyboard from a Android NativeActivity. I found this , that provides some sample code of how to get the software keyboard out (and it works), but lacks a few points of interest: How to get the input of the keyboard once displayed. How to avoid the app crashing when the user uses the back button to close the keyboard. If anyone has any answers to either of these questions, or better yet, a simpler way of showing the keyboard that does not require the use of JNI, please share. Thanks in advance, Jaime If anyone wonders, you access keyboard

How do I write to the internal storage file system with NativeActivity?

筅森魡賤 提交于 2019-11-29 22:43:57
问题 I'm porting a pure C++ game over to Android, and since my target is Android 3.0+ tablets, I opted to use NativeActivity in order to avoid Java completely. However, I am not able to see any functionality that lets me write to the device's internal storage. Calls to fopen() will fail as I have no idea which directory I am supposed to write and the internal storage filesystem is not accessible This code usually does the trick on Java, giving me the path to the internal writable data directory

Keyboard input in android NDK using NativeActivity

两盒软妹~` 提交于 2019-11-29 21:24:07
问题 I'm looking for a way of getting input from the software keyboard from a Android NativeActivity. I found this, that provides some sample code of how to get the software keyboard out (and it works), but lacks a few points of interest: How to get the input of the keyboard once displayed. How to avoid the app crashing when the user uses the back button to close the keyboard. If anyone has any answers to either of these questions, or better yet, a simpler way of showing the keyboard that does not

How to set content view of NativeActivity to component created in Java

落花浮王杯 提交于 2019-11-29 14:38:41
问题 Is there a way to set the content of a NativeActivity to a component created in Java (such as a FrameLayout, ImageView, etc)? I have a need to use a NativeActivity (for getting touchpad input on Xperia Play), but I also need to be able to view components created in the Java code. I've tried overriding the onCreate command and calling setContentView there, but although that doesn't throw any errors, it doesn't do anything either (apparently because the content view is already set by the native

Can't load native shared library with dependencies in a native activity app

帅比萌擦擦* 提交于 2019-11-28 21:54:07
In my Android app I have 4 libraries: libTemplate.so depends on libPorkholt.so libPorkholt.so depends on libpng15.so depends on liblua.so depends on libopenal.so libpng15.so liblua.so libopenal.so If I write a small command line executable that links against libTemplate and manually call ANativeActivity_onCreate, it links and runs just fine (if I point LD_LIBRARY_PATH to /data/data/com.mycompany.Template/lib) If I run my app I get this very useful error message: E/AndroidRuntime(13214): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mycompany.Template/android.app

NativeActivity does not finish

北城以北 提交于 2019-11-28 03:56:30
问题 I call a NativeActivity from a JavaActivity. The entry point of my NativeActivity is android_main(struct android_app* state) At the end of this, I call ANativeActivity_finish However my native activity just hangs, instead of returning to the Java Activity that called it (it was called simply using startActivity ). It seems like it is in a pause state. The only way I can get it to return to the previous activity is by calling exit(0) at the end of my android_main, however this kills the