Yesterday Ogre3d compiled to the Android platform after the installation, and then look back to the code found that in the Android project actually no Java source files, from the manifest file to know that the original use is nativeactivity. This look let me confused, no Java files, no activity, then I want to access ads or some other SDK how to do it? What should I do if I want to jump into the game interface from an activity?
Article from Http://blog.csdn.net/huutu qq:790621656
Ogre3d's Manifest file reads as follows: article from Http://blog.csdn.net/huutu qq:790621656
<?xml version= "1.0" encoding= "Utf-8"?><!--begin_include (manifest)--><manifest xmlns:android= "http ://schemas.android.com/apk/res/android "package=" com.example.native_activity "android:versioncode=" 1 " Android:versionname= "1.0" > <!--this is the platform API where Nativeactivity was introduced. --<USES-SDK android:minsdkversion= "9"/> <!--this apk have no Java code itself, so set Hascode to FAL Se--<application android:label= "@string/app_name" android:hascode= "false" > <!--our activity is The built-in Nativeactivity framework class. This would take care of integrating and our NDK code. --<activity android:name= "android.app.NativeActivity" android:label= "@string/app_name" android:configchanges= "Orientation|keyboardhidden" > <!--tell nativeactivity the name of OR. So --<meta-data Android:name= "Android.app.liB_name "android:value=" native-activity "/> <intent-filter> <actio n android:name= "Android.intent.action.MAIN"/> <category android:name= "Android.intent.category.LAUNCH ER "/> </intent-filter> </activity> </application></manifest> <!--end_ INCLUDE (manifest)--
You can see that the entry for the specified program is nativeactivity.article from Http://blog.csdn.net/huutu qq:790621656
Article from Http://blog.csdn.net/huutu qq:790621656
At the time of no solution, thought should be able to use an activity to inherit nativeactivity, and then immediately try, sure enough.
Article from Http://blog.csdn.net/huutu qq:790621656
The following steps:
(1) Create a new myactivity and make the corresponding layout file, create a button, add the response event, click the button to jump to the game interface.
(2) Create a new mainactivity inherit from Nativiactivity.
(3) Modify the nativiactivity in the manifest file as mainactivity.
(4) Modify the start activity in manifest to myactivity.
Project Operation Result:
Click the button to switch to the game activity (OK here is the NDK demo's Solid Color Interface)
Article from Http://blog.csdn.net/huutu qq:790621656
Demo Download:
http://download.csdn.net/detail/cp790621656/8542371
article from Http://blog.csdn.net/huutu qq:790621656
Ogre3d using Android nativeactivity