Android UI in C ++

I know it's kind of reinventing the wheel, but how hard would it be to implement the Android user interface with C ++? Is it difficult to create things like buttons and handle touch screen events like buttons? Is this possible, and if so, how would you do it?

+4
source share
3 answers

Check out Necessitas , its Qt port for Android, which seems to work very well.

Perhaps it will still be at the Alpha or Beta stage, so it will depend on how serious your project is. But this proves that you can use simple C ++ to create a complete application, not just libraries.

+3
source

You can use JNIpp to create a wrapper for the activity and all the user interface classes that interest you. Take a look at the HelloJNIpp sample , it has its own Activity, its own custom back view, and a button.

Spoiler:

void MainActivity::OnCreate(const jni::LObject& bundle) { Activity::OnCreate(bundle); SetContentView(R::GetLayout("main")); FindViewById(R::GetID("changeColor"))-> SetOnClickListener(*this,&MainActivity::ChangeColor); } 
+2
source

You can always use JNI to return to java to get the interface components on the screen. If you configure it as something more than an API, you can simulate the actual execution of this code in your own code. NVidea has some good examples of how to do this: http://developer.nvidia.com/tegra-resources This library code does not do this for user interface components, but for other things (sound, resources, etc.) . and the idea should work for user interface components.

In addition, this project supposedly supports all sdk in C ++, and I would assume that it does it the same way. I don’t know how relevant this is, since I didn’t actually use it: http://code.google.com/p/android-cpp-sdk/

+1
source

All Articles