在清单中注册应用程序类? [英] Register Application class in Manifest?

查看:90
本文介绍了在清单中注册应用程序类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Application类来保持我的应用程序的全局状态.但是我无法在清单文件中注册它?知道怎么做吗?

I have one Application class to keep the global state of my application. But I'm unable to register it in Manifest file? Any idea how to do this?

推荐答案

如果它是从Application派生的,则在清单中添加完全限定的(名称空间+类名)作为application元素的android:name参数.

If it derives from Application, add the fully qualified (namespace + class name) as the android:name parameter of the application element in your manifest.

<application
        android:name="com.you.yourapp.ApplicationEx"

或者如果可以在manifest标记中将类的包描述为相对于package,则只需以.开头:

Or if the class' package can be described as relative to the package in the manifest tag, then just start with a .:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.you.yourapp">

    <application
        android:name=".ApplicationEx"

这篇关于在清单中注册应用程序类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆