Example usage for android.app ProgressDialog setIndeterminate

List of usage examples for android.app ProgressDialog setIndeterminate

Introduction

In this page you can find the example usage for android.app ProgressDialog setIndeterminate.

Prototype

public void setIndeterminate(boolean indeterminate) 

Source Link

Document

Change the indeterminate mode for this ProgressDialog.

Usage

From source file:com.doplgangr.secrecy.views.FilesListFragment.java

void changePassphrase() {
    final View dialogView = View.inflate(context, R.layout.change_passphrase, null);
    new AlertDialog.Builder(context).setTitle(getString(R.string.Vault__change_password)).setView(dialogView)
            .setPositiveButton(R.string.OK, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int whichButton) {
                    String oldPassphrase = ((EditText) dialogView.findViewById(R.id.oldPassphrase)).getText()
                            .toString();
                    String newPassphrase = ((EditText) dialogView.findViewById(R.id.newPassphrase)).getText()
                            .toString();
                    String confirmNewPassphrase = ((EditText) dialogView.findViewById(R.id.confirmPassphrase))
                            .getText().toString();

                    ProgressDialog progressDialog = new ProgressDialog(context);
                    progressDialog.setMessage(CustomApp.context.getString(R.string.Vault__changing_password));
                    progressDialog.setIndeterminate(true);
                    progressDialog.setCancelable(false);
                    progressDialog.show();
                    changePassphraseInBackground(oldPassphrase, newPassphrase, confirmNewPassphrase,
                            progressDialog);
                }//from  w ww .  j a v  a 2 s .c  om
            }).setNegativeButton(R.string.CANCEL, Util.emptyClickListener).show();
}

From source file:com.money.manager.ex.sync.SyncManager.java

public void invokeSyncService(String action) {
    // Validation.
    String remoteFile = getRemotePath();
    // We need a value in remote file name preferences.
    if (TextUtils.isEmpty(remoteFile))
        return;//from  w ww .ja v a 2s.c  o  m

    // Action

    ProgressDialog progressDialog = null;
    // Create progress dialog only if called from the UI.
    if ((getContext() instanceof Activity)) {
        //progress dialog shown only when downloading an updated db file.
        progressDialog = new ProgressDialog(getContext());
        progressDialog.setCancelable(false);
        progressDialog.setMessage(getContext().getString(R.string.syncProgress));
        progressDialog.setIndeterminate(true);
        //            progressDialog.show();
    }
    Messenger messenger = null;
    if (getContext() instanceof Activity) {
        // Messenger handles received messages from the sync service. Can run only in a looper thread.
        messenger = new Messenger(new SyncServiceMessageHandler(getContext(), progressDialog, remoteFile));
    }

    String localFile = getDatabases().getCurrent().localPath;

    Intent syncServiceIntent = IntentFactory.getSyncServiceIntent(getContext(), action, localFile, remoteFile,
            messenger);
    // start service
    getContext().startService(syncServiceIntent);

    // Reset any other scheduled uploads as the current operation will modify the files.
    abortScheduledUpload();

    // The messages from the service are received via messenger.
}

From source file:jp.co.rediscovery.arflight.ManagerFragment.java

/**
 * ??IDeviceController?//from w  ww. ja v a 2  s . co  m
 * @param controller
 */
protected void stopController(final IDeviceController controller) {
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            final boolean show_progress = controller.isStarted();
            final ProgressDialog dialog;
            if (show_progress) {
                dialog = new ProgressDialog(getActivity());
                dialog.setTitle(R.string.disconnecting);
                dialog.setIndeterminate(true);
                dialog.show();
            } else {
                dialog = null;
            }

            queueEvent(new Runnable() {
                @Override
                public void run() {
                    try {
                        controller.stop();
                    } catch (final Exception e) {
                        Log.w(TAG, e);
                    }
                    if (dialog != null) {
                        runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                dialog.dismiss();
                            }
                        });
                    }
                }
            });
        }
    });
}

From source file:com.doplgangr.secrecy.views.FilesListFragment.java

public void onEventMainThread(Vault vault) {
    //The vault finishes initializing, is prepared to be populated.
    secret = vault;// w  ww .  j  a  v a 2 s .c om
    if (secret.isEcbVault()) {
        Util.alert(context, getString(R.string.Error__old_vault_format),
                getString(R.string.Error__old_vault_format_message), new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                        Util.alert(context, getString(R.string.Upgrade__backup_beforehand),
                                getString(R.string.Upgrade__backup_beforehand_message),
                                new DialogInterface.OnClickListener() {
                                    @Override
                                    public void onClick(DialogInterface dialog, int which) {
                                        backUp();
                                        finish();
                                    }
                                }, new DialogInterface.OnClickListener() {
                                    @Override
                                    public void onClick(DialogInterface dialogInterface, int i) {
                                        ProgressDialog progress = new ProgressDialog(context);
                                        progress.setMessage(getString(R.string.Vault_updating));
                                        progress.setIndeterminate(true);
                                        progress.setCancelable(false);
                                        progress.show();
                                        updateVaultInBackground(progress);
                                    }
                                });
                    }
                }, new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                        finish();
                    }
                });
        return;
    }

    if (secret.wrongPass) {
        Util.alert(context, getString(R.string.Error__open_vault),
                getString(R.string.Error__open_vault_message), new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                        finish();
                    }
                }, null);
        return;
    }

    addFiles();
    context.setTitle(secret.getName());
    mInitializeDialog.dismiss();
    setupViews();
}

From source file:com.money.manager.ex.MainActivity.java

public void startServiceSyncDropbox() {
    if (mDropboxHelper != null && mDropboxHelper.isLinked()) {
        Intent service = new Intent(getApplicationContext(), DropboxServiceIntent.class);
        service.setAction(DropboxServiceIntent.INTENT_ACTION_SYNC);
        service.putExtra(DropboxServiceIntent.INTENT_EXTRA_LOCAL_FILE,
                MoneyManagerApplication.getDatabasePath(this.getApplicationContext()));
        service.putExtra(DropboxServiceIntent.INTENT_EXTRA_REMOTE_FILE, mDropboxHelper.getLinkedRemoteFile());
        //progress dialog
        final ProgressDialog progressDialog = new ProgressDialog(this);
        progressDialog.setCancelable(false);
        progressDialog.setMessage(getString(R.string.dropbox_syncProgress));
        progressDialog.setIndeterminate(true);
        progressDialog.show();//from  ww w. j  a va 2s  . c  o m
        //create a messenger
        Messenger messenger = new Messenger(new Handler() {
            @Override
            public void handleMessage(Message msg) {
                if (msg.what == DropboxServiceIntent.INTENT_EXTRA_MESSENGER_NOT_CHANGE) {
                    // close dialog
                    if (progressDialog != null && progressDialog.isShowing())
                        progressDialog.hide();

                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            Toast.makeText(MainActivity.this, R.string.dropbox_database_is_synchronized,
                                    Toast.LENGTH_LONG).show();
                        }
                    });
                } else if (msg.what == DropboxServiceIntent.INTENT_EXTRA_MESSENGER_START_DOWNLOAD) {
                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            Toast.makeText(MainActivity.this, R.string.dropbox_download_is_starting,
                                    Toast.LENGTH_LONG).show();
                        }
                    });
                } else if (msg.what == DropboxServiceIntent.INTENT_EXTRA_MESSENGER_DOWNLOAD) {
                    // close dialog
                    if (progressDialog != null && progressDialog.isShowing())
                        progressDialog.hide();
                    // reload fragment
                    reloadAllFragment();
                } else if (msg.what == DropboxServiceIntent.INTENT_EXTRA_MESSENGER_START_UPLOAD) {
                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            Toast.makeText(MainActivity.this, R.string.dropbox_upload_is_starting,
                                    Toast.LENGTH_LONG).show();
                        }
                    });
                } else if (msg.what == DropboxServiceIntent.INTENT_EXTRA_MESSENGER_UPLOAD) {
                    // close dialog
                    if (progressDialog != null && progressDialog.isShowing())
                        progressDialog.hide();

                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            Toast.makeText(MainActivity.this, R.string.upload_file_to_dropbox_complete,
                                    Toast.LENGTH_LONG).show();
                        }
                    });
                }
            }
        });
        service.putExtra(DropboxServiceIntent.INTENT_EXTRA_MESSENGER, messenger);

        this.startService(service);
    }
}

From source file:fm.smart.r1.activity.ItemActivity.java

@Override
public void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    // this should be called once image has been chosen by user
    // using requestCode to pass item id - haven't worked out any other way
    // to do it// ww  w  .j  av  a2 s .c  om
    // if (requestCode == SELECT_IMAGE)
    if (resultCode == Activity.RESULT_OK) {
        // TODO check if user is logged in
        if (Main.isNotLoggedIn(this)) {
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setClassName(this, LoginActivity.class.getName());
            intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
            // avoid navigation back to this?
            LoginActivity.return_to = ItemActivity.class.getName();
            LoginActivity.params = new HashMap<String, String>();
            LoginActivity.params.put("item_id", (String) item.item_node.atts.get("id"));
            startActivity(intent);
            // TODO in this case forcing the user to rechoose the image
            // seems a little
            // rude - should probably auto-submit here ...
        } else {
            // Bundle extras = data.getExtras();
            // String sentence_id = (String) extras.get("sentence_id");
            final ProgressDialog myOtherProgressDialog = new ProgressDialog(this);
            myOtherProgressDialog.setTitle("Please Wait ...");
            myOtherProgressDialog.setMessage("Uploading image ...");
            myOtherProgressDialog.setIndeterminate(true);
            myOtherProgressDialog.setCancelable(true);

            final Thread add_image = new Thread() {
                public void run() {
                    // TODO needs to check for interruptibility

                    String sentence_id = Integer.toString(requestCode);
                    Uri selectedImage = data.getData();
                    // Bitmap bitmap = Media.getBitmap(getContentResolver(),
                    // selectedImage);
                    // ByteArrayOutputStream bytes = new
                    // ByteArrayOutputStream();
                    // bitmap.compress(Bitmap.CompressFormat.JPEG, 40,
                    // bytes);
                    // ByteArrayInputStream fileInputStream = new
                    // ByteArrayInputStream(
                    // bytes.toByteArray());

                    // TODO Might have to save to file system first to get
                    // this
                    // to work,
                    // argh!
                    // could think of it as saving to cache ...

                    // add image to sentence
                    FileInputStream is = null;
                    FileOutputStream os = null;
                    File file = null;
                    ContentResolver resolver = getContentResolver();
                    try {
                        Bitmap bitmap = Media.getBitmap(getContentResolver(), selectedImage);
                        ByteArrayOutputStream bytes = new ByteArrayOutputStream();
                        bitmap.compress(Bitmap.CompressFormat.JPEG, 40, bytes);
                        // ByteArrayInputStream bais = new
                        // ByteArrayInputStream(bytes.toByteArray());

                        // FileDescriptor fd =
                        // resolver.openFileDescriptor(selectedImage,
                        // "r").getFileDescriptor();
                        // is = new FileInputStream(fd);

                        String filename = "test.jpg";
                        File dir = ItemActivity.this.getDir("images", MODE_WORLD_READABLE);
                        file = new File(dir, filename);
                        os = new FileOutputStream(file);

                        // while (bais.available() > 0) {
                        // / os.write(bais.read());
                        // }
                        os.write(bytes.toByteArray());

                        os.close();

                    } catch (IOException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    } finally {
                        if (os != null) {
                            try {
                                os.close();
                            } catch (IOException e) {
                            }
                        }
                        if (is != null) {
                            try {
                                is.close();
                            } catch (IOException e) {
                            }
                        }
                    }

                    // File file = new
                    // File(Uri.decode(selectedImage.toString()));

                    // ensure item is in users default list

                    ItemActivity.add_item_result = addItemToList(Main.default_study_list_id,
                            (String) item.item_node.atts.get("id"), ItemActivity.this);
                    Result result = ItemActivity.add_item_result;

                    if (ItemActivity.add_item_result.success()
                            || ItemActivity.add_item_result.alreadyInList()) {

                        // ensure sentence is in users default list

                        ItemActivity.add_sentence_list_result = addSentenceToList(sentence_id,
                                (String) item.item_node.atts.get("id"), Main.default_study_list_id,
                                ItemActivity.this);
                        result = ItemActivity.add_sentence_list_result;
                        if (ItemActivity.add_sentence_list_result.success()) {

                            String media_entity = "http://test.com/test.jpg";
                            String author = "tansaku";
                            String author_url = "http://smart.fm/users/tansaku";
                            Log.d("DEBUG-IMAGE-URI", selectedImage.toString());
                            ItemActivity.add_image_result = addImage(file, media_entity, author, author_url,
                                    "1", sentence_id, (String) item.item_node.atts.get("id"),
                                    Main.default_study_list_id);
                            result = ItemActivity.add_image_result;
                        }
                    }
                    final Result display = result;
                    myOtherProgressDialog.dismiss();
                    ItemActivity.this.runOnUiThread(new Thread() {
                        public void run() {
                            final AlertDialog dialog = new AlertDialog.Builder(ItemActivity.this).create();
                            dialog.setTitle(display.getTitle());
                            dialog.setMessage(display.getMessage());
                            dialog.setButton("OK", new DialogInterface.OnClickListener() {
                                public void onClick(DialogInterface dialog, int which) {
                                    if (ItemActivity.add_image_result != null
                                            && ItemActivity.add_image_result.success()) {
                                        ItemListActivity.loadItem(ItemActivity.this,
                                                item.item_node.atts.get("id").toString());
                                    }
                                }
                            });

                            dialog.show();
                        }
                    });

                }

            };

            myOtherProgressDialog.setButton("Cancel", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    add_image.interrupt();
                }
            });
            OnCancelListener ocl = new OnCancelListener() {
                public void onCancel(DialogInterface arg0) {
                    add_image.interrupt();
                }
            };
            myOtherProgressDialog.setOnCancelListener(ocl);
            closeMenu();
            myOtherProgressDialog.show();
            add_image.start();

        }
    }
}

From source file:com.example.android.camera2basic.fragments.Camera2BasicFragment.java

public void upload() {

    //Crea y muestra barra de progreso
    final ProgressDialog mProgressDialog = new ProgressDialog(getActivity());

    mProgressDialog.setIndeterminate(false);
    mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    mProgressDialog.setMessage("Subiendo foto...");

    mProgressDialog.show();/*www .j  a v  a 2 s.  c o m*/

    //Retrofit
    Retrofit retrofit = new Retrofit.Builder().baseUrl(FileUploadService.ENDPOINT)
            .addConverterFactory(GsonConverterFactory.create()).build();

    // create upload service client
    FileUploadService service = retrofit.create(FileUploadService.class);

    // create RequestBody instance from file
    RequestBody requestFile = RequestBody.create(MediaType.parse("multipart/form-data"), mFile);

    // MultipartBody.Part is used to send also the actual file name
    MultipartBody.Part body = MultipartBody.Part.createFormData("fichero", mFile.getName(), requestFile);

    // finally, execute the request
    Call<ResponseBody> call = service.upload(body);
    call.enqueue(new Callback<ResponseBody>() {
        @Override
        public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {

            if (response.isSuccessful()) {
                mProgressDialog.hide();//Oculta progressDialog

                showToast("Upload picture success");

                Log.v(TAG, "success");
            } else {
                mProgressDialog.hide();//Oculta progressDialog

                showToast("Upload error:" + response.code());

                Log.e(TAG, "Code: " + response.code());
            }

        }

        @Override
        public void onFailure(Call<ResponseBody> call, Throwable t) {
            mProgressDialog.hide();//Oculta progressDialog

            showToast("Upload error:" + t.getMessage());

            Log.e(TAG, "onfailure: " + t.getMessage());
        }
    });

}

From source file:com.microsoft.onedrive.apiexplorer.ItemFragment.java

@Override
public void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
    final BaseApplication application = (BaseApplication) getActivity().getApplication();
    final IOneDriveClient oneDriveClient = application.getOneDriveClient();

    if (requestCode == REQUEST_CODE_SIMPLE_UPLOAD && data != null && data.getData() != null
            && data.getData().getScheme().equalsIgnoreCase(SCHEME_CONTENT)) {

        final ProgressDialog dialog = new ProgressDialog(getActivity());
        dialog.setTitle(R.string.upload_in_progress_title);
        dialog.setMessage(getString(R.string.upload_in_progress_message));
        dialog.setIndeterminate(false);
        dialog.setCancelable(false);//from   ww w .j a v  a 2 s.  co m
        dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
        dialog.setProgressNumberFormat(getString(R.string.upload_in_progress_number_format));
        dialog.show();
        final AsyncTask<Void, Void, Void> uploadFile = new AsyncTask<Void, Void, Void>() {
            @Override
            protected Void doInBackground(final Void... params) {
                try {
                    final ContentResolver contentResolver = getActivity().getContentResolver();
                    final ContentProviderClient contentProvider = contentResolver
                            .acquireContentProviderClient(data.getData());
                    final byte[] fileInMemory = FileContent.getFileBytes(contentProvider, data.getData());
                    contentProvider.release();

                    // Fix up the file name (needed for camera roll photos, etc)
                    final String filename = FileContent.getValidFileName(contentResolver, data.getData());
                    final Option option = new QueryOption("@name.conflictBehavior", "fail");
                    oneDriveClient.getDrive().getItems(mItemId).getChildren().byId(filename).getContent()
                            .buildRequest(Collections.singletonList(option))
                            .put(fileInMemory, new IProgressCallback<Item>() {
                                @Override
                                public void success(final Item item) {
                                    dialog.dismiss();
                                    Toast.makeText(getActivity(),
                                            application.getString(R.string.upload_complete, item.name),
                                            Toast.LENGTH_LONG).show();
                                    refresh();
                                }

                                @Override
                                public void failure(final ClientException error) {
                                    dialog.dismiss();
                                    if (error.isError(OneDriveErrorCodes.NameAlreadyExists)) {
                                        Toast.makeText(getActivity(), R.string.upload_failed_name_conflict,
                                                Toast.LENGTH_LONG).show();
                                    } else {
                                        Toast.makeText(getActivity(),
                                                application.getString(R.string.upload_failed, filename),
                                                Toast.LENGTH_LONG).show();
                                    }
                                }

                                @Override
                                public void progress(final long current, final long max) {
                                    dialog.setProgress((int) current);
                                    dialog.setMax((int) max);
                                }
                            });
                } catch (final Exception e) {
                    Log.e(getClass().getSimpleName(), e.getMessage());
                    Log.e(getClass().getSimpleName(), e.toString());
                }
                return null;
            }
        };
        uploadFile.execute();
    }
}

From source file:info.staticfree.android.units.Units.java

@Override
protected Dialog onCreateDialog(int id) {
    switch (id) {
    case DIALOG_ABOUT: {
        final Builder builder = new AlertDialog.Builder(this);

        builder.setTitle(R.string.dialog_about_title);
        builder.setIcon(R.drawable.icon);

        try {//from w w w .  j  av  a  2 s . c o  m
            final WebView wv = new WebView(this);
            final InputStream is = getAssets().open("README.xhtml");
            wv.loadDataWithBaseURL("file:///android_asset/", inputStreamToString(is), "application/xhtml+xml",
                    "utf-8", null);
            wv.setBackgroundColor(0);
            builder.setView(wv);
        } catch (final IOException e) {
            builder.setMessage(R.string.err_no_load_about);
            e.printStackTrace();
        }

        builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                setResult(RESULT_OK);
            }
        });
        return builder.create();
    }

    case DIALOG_ALL_UNITS: {
        final Builder b = new Builder(Units.this);
        b.setTitle(R.string.dialog_all_units_title);
        final ExpandableListView unitExpandList = new ExpandableListView(Units.this);
        unitExpandList.setId(android.R.id.list);
        final String[] groupProjection = { UsageEntry._ID, UsageEntry._UNIT, UsageEntry._FACTOR_FPRINT };
        // any selection below will select from the grouping description
        final Cursor cursor = managedQuery(UsageEntry.CONTENT_URI_CONFORM_TOP, groupProjection, null, null,
                UnitUsageDBHelper.USAGE_SORT);

        unitExpandList.setAdapter(new UnitsExpandableListAdapter(cursor, this,
                android.R.layout.simple_expandable_list_item_1, android.R.layout.simple_expandable_list_item_1,
                new String[] { UsageEntry._UNIT }, new int[] { android.R.id.text1 },
                new String[] { UsageEntry._UNIT }, new int[] { android.R.id.text1 }));
        unitExpandList.setCacheColorHint(0);
        unitExpandList.setOnChildClickListener(allUnitChildClickListener);
        b.setView(unitExpandList);
        return b.create();
    }

    case DIALOG_UNIT_CATEGORY: {
        final Builder b = new Builder(new ContextThemeWrapper(this, android.R.style.Theme_Black));
        final String[] from = { UsageEntry._UNIT };
        final int[] to = { android.R.id.text1 };
        b.setTitle("all units");
        final String[] projection = { UsageEntry._ID, UsageEntry._UNIT, UsageEntry._FACTOR_FPRINT };
        final Cursor c = managedQuery(UsageEntry.CONTENT_URI, projection, null, null,
                UnitUsageDBHelper.USAGE_SORT);
        dialogUnitCategoryList = new SimpleCursorAdapter(this, android.R.layout.select_dialog_item, c, from,
                to);
        b.setAdapter(dialogUnitCategoryList, dialogUnitCategoryOnClickListener);

        return b.create();
    }

    case DIALOG_LOADING_UNITS: {
        final ProgressDialog pd = new ProgressDialog(this);
        pd.setIndeterminate(true);
        pd.setTitle(R.string.app_name);
        pd.setMessage(getText(R.string.dialog_loading_units));
        return pd;
    }

    default:
        throw new IllegalArgumentException("Unknown dialog ID:" + id);
    }
}

From source file:uk.co.armedpineapple.cth.SDLActivity.java

private void installFiles(final SharedPreferences preferences) {
    final ProgressDialog dialog = new ProgressDialog(this);
    final UnzipTask unzipTask = new UnzipTask(app.configuration.getCthPath() + "/scripts/", this) {

        @Override/*from   w  ww .j  av  a  2 s.  c  om*/
        protected void onPreExecute() {
            super.onPreExecute();
            dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
            dialog.setMessage(getString(R.string.preparing_game_files_dialog));
            dialog.setIndeterminate(false);
            dialog.setCancelable(false);
            dialog.show();
        }

        @Override
        protected void onProgressUpdate(Integer... values) {
            super.onProgressUpdate(values);
            dialog.setProgress(values[0]);
            dialog.setMax(values[1]);
        }

        @Override
        protected void onPostExecute(AsyncTaskResult<String> result) {
            super.onPostExecute(result);
            Exception error;
            if ((error = result.getError()) != null) {
                Log.d(LOG_TAG, "Error copying files.");
                BugSenseHandler.sendException(error);
            }

            Editor edit = preferences.edit();
            edit.putBoolean("scripts_copied", true);
            edit.putInt("last_version", currentVersion);
            edit.commit();
            dialog.hide();
            loadApplication();
        }

    };

    AsyncTask<String, Void, AsyncTaskResult<File>> copyTask = new

    AsyncTask<String, Void, AsyncTaskResult<File>>() {

        @Override
        protected AsyncTaskResult<File> doInBackground(String... params) {

            try {
                Files.copyAsset(SDLActivity.this, params[0], params[1]);
            } catch (IOException e) {

                return new AsyncTaskResult<File>(e);
            }
            return new AsyncTaskResult<File>(new File(params[1] + "/" + params[0]));
        }

        @Override
        protected void onPostExecute(AsyncTaskResult<File> result) {
            super.onPostExecute(result);
            File f;
            if ((f = result.getResult()) != null) {
                unzipTask.execute(f);
            } else {
                BugSenseHandler.sendException(result.getError());

            }
        }

    };

    if (Files.canAccessExternalStorage()) {

        copyTask.execute(ENGINE_ZIP_FILE, getExternalCacheDir().getAbsolutePath());
    } else {
        DialogFactory.createExternalStorageWarningDialog(this, true).show();
    }
}