android - 在 list 中注册应用程序类?

标签 android android-studio android-applicationinfo

<分区>

我想在 list 文件中注册我覆盖的应用程序类

已提出问题(对我的情况没有帮助)Register Application class in Manifest?

在上面的问题中。用户得到了他的答案。但就我而言。 android:name=""由 android name="io.branch.refferal.branchApp"填充

如果我用我的应用程序类名替换该名称,我的分支 api 将不起作用。

那么,我该如何在 list 文件中注册我的应用程序类

附注我已经制作了应用程序文件以使用 chrisjenx 的 Calligraphy api,为整个应用程序设置我的字体

代码 fragment :

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme"
    android:name="io.branch.referral.BranchApp"
    >
    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

我的应用类如下:

package absdevelopers.com.brankreferal;

import uk.co.chrisjenx.calligraphy.CalligraphyConfig;


public class Application extends android.app.Application {

    @Override
    public void onCreate() {
        super.onCreate();

        CalligraphyConfig.initDefault("fonts/My-font.ttf");

    }
}

最佳答案

查看您的包名 + 类名以获取 Manifest 值。

但是,如果您想使用 BranchApp 功能,则需要扩展它而不是原始的 Application 类。

package absdevelopers.com.brankreferal;

import uk.co.chrisjenx.calligraphy.CalligraphyConfig
import io.branch.referral.BranchApp;

public class Application extends BranchApp

然后在 list 中使用您的应用程序

<application
    android:name="absdevelopers.com.brankreferal.Application"

关于android - 在 list 中注册应用程序类?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36110874/

相关文章:

Android 应用程序在签名后无法对 HTTPS 进行 ajax 调用

android - 在 Android 的后台线程中运行 GPS 定位

java - 在 Android 和 "other platforms"之间生成可移植应用程序的推荐方法

android - Gradle 错误 - 无法在任务 ':project:mergeDebugResources' 上调用 IncrementalTask​​.taskAction()

java - android fully_qualified_classname 不可分配给 'android.app.application'

Android - 如何知道应用程序在后台后何时恢复

android - 有什么方法可以检测到哪些应用程序我可以/不能访问他们的 "app-info"屏幕?

java - 从android(Flatbuffers)中的url获取字节[]数组中的二进制数据

android-studio - 如何在android studio中导出版权声明

android - Exoplayer r1.5.2 无法解析 com.google.android.exoplayer :exoplayer:r1. 5.2