开发者

How do I change the Android Manifest to launch an Application instead of an Activity?

I would like my program to extend the Application class to and launch from it's Overridden onCreate() method, rather than from an A开发者_JS百科ctivity class. How do I change the manifest to launch an application?

I only know how to launch activities like this:

    <activity
        android:name=".TestActivity"
        android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

How can I tell Android that it needs to launch from an Application instead?


First of all check the use of Application Class

Application class is used to declare Global variables and other stuffs but it doesn't have any UI.

To declare Application class you just need to add android:name attribute in your application tag in the AndroidManifest file

<application android:icon="@drawable/icon" android:label="@string/app_name" android:name=".myApplication_class_name">


You can't. Android does not work this way. Activities are a main UI component. If you want to show UI to user you must use activities.

http://developer.android.com/guide/topics/fundamentals.html#Components

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜