0

In my activity I want to start a class which extends an AndroidApplication class but I don't know how to do it. I want to call the onCreate method of the AndroidApplication class, of course.

public class MainActivity extends Activity { @Override public void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(R.layout.layout); new AndroidLauncher(); } } 

Here is the manifest:

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.utente.morramongame" android:versionCode="1" android:versionName="1.0"> <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="25"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.READ_PHONE_STATE"/> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/GdxTheme"> <application android:name=".AndroidLauncher"> </application> <activity android:name=".MainActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenSize" android:label="@string/app_name" android:screenOrientation="landscape"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> </application> 

19
  • register it in manifest application tag Commented Jun 11, 2017 at 17:03
  • @Pavneet_Singh and then? Commented Jun 11, 2017 at 17:05
  • onCreate is automatically called if you set the Application up correctly Commented Jun 11, 2017 at 17:09
  • Application is created by the framework. You never create it or any other Android component yourself. Commented Jun 11, 2017 at 17:10
  • Also see: Why create an Application class Commented Jun 11, 2017 at 17:10

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.