小编Idk*_*All的帖子

无法解析符号'权限'Android Studio

这是我遇到问题的代码行

    int permissionCheck = ContextCompat.checkSelfPermission(MainActivity.this,
            Manifest.permission.WRITE_EXTERNAL_STORAGE);
Run Code Online (Sandbox Code Playgroud)

它在我的内心 public class MainActivity extends AppCompatActivity {

没有选项可以导入任何东西

IMG

这是我的进口清单

IMG2

import android android-permissions

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

如何等待 DownloadManager 完成?

这是我当前使用的代码

                String iosjiUrl = "http://modapps.com/NotoCoji.ttf";
                DownloadManager.Request request = new DownloadManager.Request(Uri.parse(iosjiUrl));
                request.setDescription("Sscrition");
                request.setTitle("Somle");
// in order for this if to run, you must use the android 3.2 to compile your app
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
                    request.allowScanningByMediaScanner();
                    request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
                }
                request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "NotoColorji.ttf");

// get download service and enqueue file
                DownloadManager manager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);

                manager.enqueue(request);
Run Code Online (Sandbox Code Playgroud)

我无法找到一种方法让我等待文件下载。

我还尝试弄清楚如何进行异步,但无法弄清楚=/

再次感谢!

android android-download-manager

3
推荐指数
1
解决办法
8429
查看次数