Native Activity vs SDK Activity in terms of U.I
Asked Answered
M

1

1

I've been doing a fair amount of research, and have even experimented some with the NDK for Android (not so much the SDK). What I haven't been able to really find though is a clear and concise definition for what the NDK cannot do (besides lack of exception handling and rtti).

I've been mapping out some code for a game and a game engine for Android (Written entirely in the NDK) but it seems to not be as supported as many would like it to be. Not only that, but I'd like to be able to give my game a sexy U.I. without having to write everything from scratch in OpenGL.

While I'm sure it's easier in Java, I'd like to know if the NDK's front end/U.I. components are getting to a point to where they'd even be comparable with Java in terms of Touchscreen IO , Sound, and Graphical Interfaces. Worst case scenario I can write the U.I. in Java and just call native methods from that, but I'd like to be able to do more if possible.

Thanks.

Edit

If C++ is even somewhat on par with Java's U.I. feature set, it would be cool to know which of the two gives more control and customization. For example, while the Java implementation may be easier to use, does it give the programmer a lot of options to fine tune a "look" which resembles something specific?

Mucous answered 25/4, 2012 at 2:55 Comment(0)
C
3

Official NDK can do exceptions and rtti just fine. Read the "docs/CPLUSPLUS-SUPPORT.html" file distributed with Android NDK.

In C++ only thing you can not do is implement Java interface, inherit Java class and define new Java class. Otherwise - you can do everthing Java can. Only problem with that will be that a lot of things (like accessing Java object members, or calling Java functions) will require usage of JNI and that code will look really ugly. So if you need for UI creating/inheritance of Java classes, then you can code everything in C++.

I suggest to use JNI only for performance critical code. Mixing code - Java for UI, mathematical calculations in C/C++ is really easy. Or if you code game by using OpenGL ES - that's also fine.

Cardenas answered 25/4, 2012 at 6:0 Comment(2)
Would it make sense to initialize an ES 2.0 context in Java using activities and surface views, and then implementing the rest of the GL code in C/C++?Mucous
That is the only way how to do it, if you don't take NativeActivity.Cumquat

© 2022 - 2024 — McMap. All rights reserved.