-1

I'm following this post to add a application class to initialize my application, i did as follow: Initialisation.java

package com.thinline.dm21.init;

import android.app.Application;
import android.util.Log;

public class Initialisation extends Application{

  public void onCreate() {
    super.onCreate();
    Log.i("Test","Executed");
  }     
}

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.thinline.dm21"
android:versionCode="1"
android:versionName="1.0">

<uses-permission android:name="android.permission.INTERNET" />
<uses-sdk
    android:minSdkVersion="11"
    android:targetSdkVersion="15" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.NoTitleBar" >
    <activity
        android:name="com.thinline.dm21.calendrier.Calendrier"
        android:label="@string/app_name"
        android:configChanges="orientation" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>
<application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"        
        android:name="com.thinline.dm21.init.Initialisation">       
</application>

</manifest>

but i dont see my message in the logcat. What am i missing ?

Community
  • 1
  • 1
Blacksword888
  • 61
  • 1
  • 8
  • Is there a question you are asking here? EDIT:Much Better, Thanks :) – RGG Jul 05 '13 at 17:14
  • Why would you need a second Application? You could just set the android:name attribute in the first one. – Bernd S Jul 05 '13 at 17:18
  • yes it is in the bottom of the message "but i dont see my message in the logcat. What am i missing ?", normally i should be able te see the Log.i() who's in the onCreate method of Initialisation, but nothing shows – Blacksword888 Jul 05 '13 at 17:19
  • @BerndS, i need it to execute some initialisation code, i could have done it in my activity'onCreate method, but when i rotate my tablet, the onCreate is called a second time – Blacksword888 Jul 05 '13 at 17:22
  • @Blacksword888: My point was that you have already an application specified. You can do it there. See mah's answer. – Bernd S Jul 05 '13 at 19:32

1 Answers1

0

You're defining the <application> in your manifest twice. Merge it into a single entry. (That is, move the android:name out of the second entry into the first, then delete the second.)

mah
  • 39,056
  • 9
  • 76
  • 93
  • thank you, it worked. now, i just want to understand how to add one or multiple Application class (Maybe one for handling Global variables) – Blacksword888 Jul 05 '13 at 17:26
  • Your manifest can describe only a single application (and your APK can contain only a single application); this is by design. An "application" is really just a container hold one 0 or more activities, broadcast receivers, etc. – mah Jul 05 '13 at 17:31