小编sma*_*133的帖子

检测视图是否重叠

我在另一个尺寸的屏幕上绘制视图时遇到问题!我需要有两个View类型参数的方法.如果第一个视图在第二个视图上重叠,则返回true,而在另一个视图中则返回false

在此输入图像描述

在此输入图像描述

android view

15
推荐指数
4
解决办法
8679
查看次数

Android:是否有可能获得其他应用通知信息?

我对Android中的辅助功能服务有疑问.
我可以在状态栏中捕获通知并从通知中获取信息吗?

我的目的是捕获Viber,Skype等应用程序的通知.

那可能吗?

android android-notifications accessibilityservice

10
推荐指数
2
解决办法
9236
查看次数

Google帐户获取令牌

我有一个kitkat api的问题,同时tringy获取谷歌帐户服务的访问令牌,在我的情况下谷歌音乐.因此,如果用户首先使用next方法尝试获取令牌:

 public String getAuthToken(Account account)
            throws AuthenticatorException, IOException {
        String s1;
        if (account == null) {
            Log.e("MusicAuthInfo", "Given null account to MusicAuthInfo.getAuthToken()", new Throwable());
            throw new AuthenticatorException("Given null account to MusicAuthInfo.getAuthToken()");
        }
        String s = getAuthTokenType(mContext);
        try {
            s1 = AccountManager.get(mContext).blockingGetAuthToken(account, s, true);
        } catch (OperationCanceledException operationcanceledexception) {
            throw new AuthenticatorException(operationcanceledexception);
        }
        if (s1 == null) {
            throw new AuthenticatorException("Received null auth token.");
        }

        return s1;
    }
Run Code Online (Sandbox Code Playgroud)

在这里,我得到s1 == null和系统推送通知:

通知

当用户点击通知时,会出现下一个对话框:

对话

当用户单击"确定"时,获取令牌的所有下一次迭代都会成功.

问题:如何绕过此确认或仅显示对话框,而不点击通知?

android google-api-client

7
推荐指数
1
解决办法
2919
查看次数

Android 加密大文件

我尝试加密和解密大型音频二进制文件。使用 CipherInputStream 和 CipherOutputStream。我知道,关于像这样的主题存在许多问题。但我不明白我的代码有什么问题。请描述清楚是什么错误。谢谢。

public void encrypt() {
    doCrypto(Cipher.ENCRYPT_MODE, KEY);
}

public void decrypt() {
    doCrypto(Cipher.DECRYPT_MODE, KEY);
}

private void doCrypto(int cipherMode, String key) {
    try {
        Key secretKey = new SecretKeySpec(key.getBytes("UTF-8"), "AES");
        Cipher cipher = Cipher.getInstance("AES");
        cipher.init(cipherMode, secretKey);

        FileInputStream inputStream = new FileInputStream(this);
        FileOutputStream fileOutputStream = new FileOutputStream(this);

        int read;

        CipherInputStream cis = new CipherInputStream(inputStream, cipher);
        CipherOutputStream cos = new CipherOutputStream(fileOutputStream, cipher);

        while ((read = cis.read()) != -1) {
            cos.write(read);
            cos.flush();
        }
        cos.close();
        cis.close();

        inputStream.close();
        fileOutputStream.close();

    } catch (NoSuchPaddingException …
Run Code Online (Sandbox Code Playgroud)

encryption android

-2
推荐指数
1
解决办法
1677
查看次数