I am making demo app in cocos2d-x where I am trying to integrate admob ads in that. I am adding it in to the game_demo.xml layout where cocos2dx GLSurfaceview is getting added. It works proper throughout the cocos2d-x scenes. But now If I want that view to visible only in specific scenes how to go about it ? I know JNI comes in to the picture but I do not know how will I use those JNI calls for making View invisible or Gone as we do it in normal android way.
Asked
Active
Viewed 1,388 times
1 Answers
0
I guess you have to go through jni create a static method in cocos2dxActiity.java called
setDisplayAd(bool value){
//your java code goes here.
//disable or enable the ad activity here
}
than you need to call this Java method in your cocod2d-x code (in the scene you want)

m.ding
- 3,172
- 19
- 27
-
I did it there is an example how to use JNI in cocos2d-x ( how to call Java from C++ and vice versa) given by them on their site. thanks for your help ... – user1169079 Jul 09 '12 at 03:56
-
It's not too hard, isn't it? As long as you can do this, you can call whatever function in Java like open browser, use Camara (a bit difficult, need to read the raw image data), send Email, etc. It worth to learn JNI if you'd like to stick on cocos2d-x for developing android. – m.ding Jul 09 '12 at 06:35
-
yes indeed its not that hard if you once know how it works itz fun... and i understood those things in cocos2d-x way. Now i m little bit clear how cocos2d-x engine works ...i will dig more in to it ... I'm loving it – user1169079 Jul 09 '12 at 06:54