为什么不能在<application>标签中添加name属性
2016-08-10 · 做真实的自己 用良心做教育
千锋教育
千锋教育专注HTML5大前端、JavaEE、Python、人工智能、UI&UE、云计算、全栈软件测试、大数据、物联网+嵌入式、Unity游戏开发、网络安全、互联网营销、Go语言等培训教育。
向TA提问
关注
展开全部
刚查了下google的开发者文档里面对这个name标签的解释
引用:
android:name
The fully qualified name of an Application subclass implemented for the application. When the application process is started, this class is instantiated before any of the application's components.
The subclass is optional; most applications won't need one. In the absence of a subclass, Android uses an instance of the base Application class.原来这个name不是我想的那样随随便便取得名字,一般都没有的(默认是android.app.Application),如洞汪和果非要有的话,这纳盯个名字必须是继承自application的陵余一个类名
比如
代码:
public class MyApp extends Application{
//TODO
}
然后才能在AndroidManifest.xml中配置这个application的name属性
代码:
<application android:name="MyApp" ...>
...
</application>
引用:
android:name
The fully qualified name of an Application subclass implemented for the application. When the application process is started, this class is instantiated before any of the application's components.
The subclass is optional; most applications won't need one. In the absence of a subclass, Android uses an instance of the base Application class.原来这个name不是我想的那样随随便便取得名字,一般都没有的(默认是android.app.Application),如洞汪和果非要有的话,这纳盯个名字必须是继承自application的陵余一个类名
比如
代码:
public class MyApp extends Application{
//TODO
}
然后才能在AndroidManifest.xml中配置这个application的name属性
代码:
<application android:name="MyApp" ...>
...
</application>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询