How can I create a new NativeWindow in Android NDK?

你离开我真会死。 提交于 2019-12-03 03:30:28

If you look inside the git trees for Android, you will see that there are several simple test apps that create a native window and are launched from the command line.

click here to see the tests

Regarding the questions to some of the comments above by Albus, the issue with the flip chain is because your current driver can only support 1 flip chain in the system, and that's being held by SurfaceFlinger since that's the entity who can write to the native window/framebuffer. To work around this you can just stop the Android Run Time engine by typing 'stop' inside adb shell, then re-run your app. To get the Android Run time engine back up, do 'start'.

Here's an example of using EGL from command line:

http://jiggawatt.org/badc0de/android/index.html

However such process without 'legal' Android UI Activity is going to be killed by the system at any time for being considered as a background process. Also you wouldn't be able you use touchscreen or keyboard input, or any other stuff that require Context, like figuring out where the SD card is mounted, etc.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!