相关疑难解决方法(0)

将 ProgressBar 与 DownloadManager 结合使用

在我的应用程序中,我用来DownloadManager从 Firebase 下载文件。

import static android.os.Environment.DIRECTORY_DOWNLOADS;

public class Physics extends AppCompatActivity {
PDFView pdfView;
FirebaseStorage firebaseStorage;
StorageReference storageReference;
StorageReference ref;
File file;
File files;
ProgressBar progressBar;
private Context context;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
    setContentView(R.layout.activity_physics1);

    pdfView = findViewById(R.id.pdfview);
    progressBar = (ProgressBar) findViewById(R.id.progressBar);


    Context mContext = getApplicationContext();
    String path = mContext.getFilesDir().getAbsolutePath() + "/storage/emulated/0/Android/data/com.impwala.impwala/files/Download/asd.nomedia";
    File file = new File("/storage/emulated/0/Android/data/com.impwala.impwala/files/Download/asd.nomedia");

    if (file.exists()) {
        files = new File("/storage/emulated/0/Android/data/com.impwala.impwala/files/Download/asd.nomedia");
        pdfView.fromFile(files).load();
    } else {
        if (haveNetwork()) {
            download();
        } else …
Run Code Online (Sandbox Code Playgroud)

android android-download-manager firebase-storage

6
推荐指数
1
解决办法
6445
查看次数