Example usage for android.app ProgressDialog STYLE_SPINNER

List of usage examples for android.app ProgressDialog STYLE_SPINNER

Introduction

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

Prototype

int STYLE_SPINNER

To view the source code for android.app ProgressDialog STYLE_SPINNER.

Click Source Link

Document

Creates a ProgressDialog with a circular, spinning progress bar.

Usage

From source file:net.kazzz.NFCTagWriter.java

/**
 * ????????/*from  w w  w.java2s  .com*/
 * ?VICC???????
 * 
 */
public void onClick(final View v) {
    try {
        final int id = v.getId();
        if (id != R.id.btn_write)
            return;

        final ProgressDialog dialog = new ProgressDialog(this);
        dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        dialog.setIndeterminate(true);

        AsyncTask<Void, Void, ?> writeDataTask = null;
        if (isFeliCaLiteTag(mNfcTag)) {
            // FeliCatLite
            writeDataTask = new FeliCaLiteWriteTask(this, mNfcTag);
        } else

        if (isISO15693Tag(mNfcTag)) {
            final CheckBox chkUseNDEF = (CheckBox) findViewById(R.id.chk_useNDEF);
            //ISO15693
            writeDataTask = new ISO15693WriteTask(this, mNfcTag, chkUseNDEF.isChecked());
        }
        // ??
        writeDataTask.execute();

    } catch (Exception e) {
        e.printStackTrace();
        Log.e(TAG, "writeData", e);
        Toast.makeText(v.getContext(), "???? : " + e.getMessage(), Toast.LENGTH_LONG).show();
    }
}

From source file:org.sufficientlysecure.keychain.ui.CertifyKeyActivity.java

/**
 * kicks off the actual signing process on a background thread
 *///from   ww  w . j a  v a 2s. co  m
private void startRevokation() {

    // Bail out if there is not at least one user id selected
    ArrayList<String> userIds = mUserIdsAdapter.getSelectedUserIds();
    if (userIds.isEmpty()) {
        AppMsg.makeText(CertifyKeyActivity.this, "No User IDs to sign selected!", AppMsg.STYLE_ALERT).show();
        return;
    }

    // Send all information needed to service to sign key in other thread
    Intent intent = new Intent(this, KeychainIntentService.class);

    intent.setAction(KeychainIntentService.ACTION_REVOKE_KEYRING);

    // fill values for this action
    Bundle data = new Bundle();

    data.putLong(KeychainIntentService.CERTIFY_KEY_MASTER_KEY_ID, mMasterKeyId);
    data.putLong(KeychainIntentService.CERTIFY_KEY_PUB_KEY_ID, mPubKeyId);
    data.putStringArrayList(KeychainIntentService.CERTIFY_KEY_UIDS, userIds);

    intent.putExtra(KeychainIntentService.EXTRA_DATA, data);

    // Message is received after signing is done in KeychainIntentService
    KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(this,
            getString(R.string.progress_signing), ProgressDialog.STYLE_SPINNER) {
        public void handleMessage(Message message) {
            // handle messages by standard KeychainIntentServiceHandler first
            super.handleMessage(message);

            if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) {

                AppMsg.makeText(CertifyKeyActivity.this, R.string.key_certify_success, AppMsg.STYLE_INFO)
                        .show();

                // check if we need to send the key to the server or not
                if (mUploadKeyCheckbox.isChecked()) {
                    // upload the newly signed key to the keyserver
                    uploadKey();
                } else {
                    setResult(RESULT_OK);
                    finish();
                }
            }
        }
    };

    // Create a new Messenger for the communication back
    Messenger messenger = new Messenger(saveHandler);
    intent.putExtra(KeychainIntentService.EXTRA_MESSENGER, messenger);

    // show progress dialog
    saveHandler.showProgressDialog(this);

    // start service with intent
    startService(intent);
}

From source file:com.example.alyshia.customsimplelauncher.MainActivity.java

private void checkProkioskEnabled() {
    Log.d(TAG, "checking prokioskenabled");
    if (pkm == null) {
        if (cdm == null) {
            cdm = CustomDeviceManager.getInstance();
        }/*from  ww  w . ja  v  a 2s. c  o m*/
        pkm = cdm.getProKioskManager();
    }
    if (!pkm.getProKioskState()) {
        //if not in prokiosk
        if (mDialog == null) {
            mDialog = new ProgressDialog(this, R.style.customDialog);
            mDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
            mDialog.setMessage("Please wait while applying user's setting");
            mDialog.setCancelable(false);
            mDialog.show();
        } else {
            if (!mDialog.isShowing()) {
                mDialog.show();
            }
        }

        //request prokioskenable
        if (myPKManager == null) {
            myPKManager = new PKManager(this, MainActivity.this);
        }
        myPKManager.startKiosk();
    }
}

From source file:com.zia.freshdocs.widget.adapter.CMISAdapter.java

protected void startProgressDlg(boolean indeterminate) {
    Context context = getContext();
    Resources res = context.getResources();

    if (mProgressDlg == null || !mProgressDlg.isShowing()) {
        mProgressDlg = new ProgressDialog(context);
        mProgressDlg.setProgressStyle(/*  www  .  j a  va  2  s  .  c  om*/
                indeterminate ? ProgressDialog.STYLE_SPINNER : ProgressDialog.STYLE_HORIZONTAL);
        mProgressDlg.setMessage(res.getString(R.string.loading));
        mProgressDlg.setTitle("");
        mProgressDlg.setCancelable(true);
        mProgressDlg.setIndeterminate(indeterminate);
        mProgressDlg.setOnCancelListener(new OnCancelListener() {
            public void onCancel(DialogInterface dialog) {
                interrupt();
            }
        });
        mProgressDlg.show();
    }
}

From source file:com.housekeeper.ar.healthhousekeeper.RegisterActivity.java

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    /*/*from  w  w w . java2  s.c o m*/
     if (savedInstanceState != null) {   
        String zcpsStr = savedInstanceState.getString("zcps");
        zcpsET.setText(zcpsStr);
    }
    */
    SysApplication.getInstance().addActivity(this);
    setContentView(R.layout.activity_register);
    toastCommom = ToastCommom.createToastConfig();
    MyActivityManager.pushOneActivity(RegisterActivity.this);
    myApp = (MyApp) getApplication();
    http = myApp.getHttp();

    backBtn = (Button) findViewById(R.id.back_btn);
    backBtn.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            finish();
        }
    });
    //APP?
    Log.i(TAG, "filename oncreate ");
    String fileName = myApp.getJoStartPath();

    Log.i(TAG, "fileName:" + fileName);
    if (fileName != null) {
        try {
            readFileCache = saveCache.read(fileName);
            joReadFileCache = new JSONObject(readFileCache);
            String result = joReadFileCache.getString("result");
            String resultMessage = joReadFileCache.getString("resultMessage");
            //?value
            JSONObject joValue = joReadFileCache.getJSONObject("value");
            //?provinces
            jaProvinces = joValue.getJSONArray("provinces");
            joProvinces = new JSONObject[jaProvinces.length()];
            nameProvinces = new String[jaProvinces.length()];
            //nameProvinces[0] = "-?-";
            for (int i = 0; i < jaProvinces.length(); i++) {
                joProvinces[i] = jaProvinces.getJSONObject(i);
                nameProvinces[i] = joProvinces[i].getString("name");
                Log.v(TAG, "nameProvinces:" + nameProvinces[i]);
            }

            jaPros = joValue.getJSONArray("jobTitles");
            joPros = new JSONObject[jaPros.length()];
            namePros = new String[jaPros.length()];
            idJobTitles = new int[namePros.length];
            for (int i = 0; i < jaPros.length(); i++) {
                joPros[i] = jaPros.getJSONObject(i);
                namePros[i] = joPros[i].getString("name");
                idJobTitles[i] = joPros[i].getInt("id");
                Log.v(TAG, "namePros:" + namePros[i]);
                Log.v(TAG, "idJobTitles:" + idJobTitles[i]);
            }

        } catch (Exception e) {
            // TODO Auto-generated catch block

            e.printStackTrace();
        }
    } else {
        nameProvinces = new String[] { "" };
        nameCities = new String[] { "" };
        nameHospitals = new String[] { "" };
        nameDepartments = new String[] { "" };
        namePros = new String[] { "" };
    }

    //        prePageBtn = (Button)findViewById(R.id.pre_btn);
    firstPageLayout = (RelativeLayout) findViewById(R.id.first_layout);
    //      nextPageBtn = (Button)findViewById(R.id.next_btn);
    //      secondPageLayout = (RelativeLayout)findViewById(R.id.second_layout);
    yanzhengmaLayout = (LinearLayout) findViewById(R.id.yanzhengma_layout);
    yanzhengmaRegBtn = (Button) findViewById(R.id.yanzhengma_regbtn);
    titleTextView = (TextView) findViewById(R.id.title);
    yanzhengmaPsdEditText = (EditText) findViewById(R.id.password_et);
    yanzhengmaZhangHuEditText = (EditText) findViewById(R.id.zhanghu_et);

    workIdEditText = (EditText) findViewById(R.id.work_id_et);

    usernameET = (TextView) findViewById(R.id.username_et);
    psdET = (TextView) findViewById(R.id.psd_et);
    psdaET = (EditText) findViewById(R.id.psd_again_et);
    nameET = (EditText) findViewById(R.id.name_et);
    idET = (EditText) findViewById(R.id.id_et);
    //      yszET = (EditText)findViewById(R.id.zyys_et);
    //      zczET = (EditText)findViewById(R.id.yszc_et);
    //      zcpsET = (EditText)findViewById(R.id.zcps_et);
    //      skillET = (EditText)findViewById(R.id.zs_et);
    //      detailET = (EditText)findViewById(R.id.xxxx_et);
    telET = (EditText) findViewById(R.id.tel_et);
    mailET = (EditText) findViewById(R.id.mail_et);
    photo = (ImageView) findViewById(R.id.photo_image);
    //        meetplacET = (EditText)findViewById(R.id.address_et);
    regBtn = (Button) findViewById(R.id.regbtn);
    photoBtn = (Button) findViewById(R.id.photoBtn);
    //      zcpsBtn = (Button)findViewById(R.id.zcps_btn);
    //      zyysBtn = (Button)findViewById(R.id.zyys_btn);
    //      yszcBtn = (Button)findViewById(R.id.yszc_btn);
    signBtn = (Button) findViewById(R.id.sign_btn);
    //birthday
    birthdayStr = yearStr + "-" + monthStr + "-" + dayStr;
    year = (Spinner) findViewById(R.id.yearspinner);
    month = (Spinner) findViewById(R.id.monthspinner);
    day = (Spinner) findViewById(R.id.dayspinner);
    //sex
    sex = (Spinner) findViewById(R.id.sex_spinner);
    //province-city-hospital
    sheng = (Spinner) findViewById(R.id.sheng_spinner);
    shi = (Spinner) findViewById(R.id.shi_spinner);
    yy = (Spinner) findViewById(R.id.yy_spinner);
    //?
    //      pro = (Spinner)findViewById(R.id.pro_spinner);
    //-
    //      ks = (Spinner)findViewById(R.id.ks_spinner);
    //ksfl = (Spinner)findViewById(R.id.ksfl_spinner);
    //      departmentTypeTv = (TextView)findViewById(R.id.ksfl_tv);
    final List<String> yearList = getYearData();
    final List<String> monthList = getMonthData();
    final List<String> dayList = getDayData();

    yanzhengmaLayout.setVisibility(View.VISIBLE);
    firstPageLayout.setVisibility(View.GONE);
    yanzhengmaRegBtn.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            yanzhengmaLayout.setVisibility(View.GONE);
            firstPageLayout.setVisibility(View.VISIBLE);
            titleTextView.setText("     ");
            usernameET.setText(yanzhengmaZhangHuEditText.getText().toString());
            psdET.setText(yanzhengmaPsdEditText.getText().toString());
            psdaET.setText(yanzhengmaPsdEditText.getText().toString());
            telET.setText(yanzhengmaZhangHuEditText.getText().toString());
        }
    });
    //      final String yearArray[] = new String[yearList.size()];
    //      if(yearList != null){
    //         for(int i = 0 ;i<yearList.size();i++){
    //            yearArray[i] = yearList.get(i);
    //         }
    //      }

    //      // ArrayAdapter??
    //      ArrayAdapter<String> yearAdapter = new ArrayAdapter<String>
    //            (RegisterActivity.this, android.R.layout.simple_spinner_item,getYearData());
    //      ArrayAdapter<String> monthAdapter = new ArrayAdapter<String>
    //            (RegisterActivity.this, android.R.layout.simple_spinner_item,getMonthData());
    //      ArrayAdapter<String> dayAdapter = new ArrayAdapter<String>
    //            (RegisterActivity.this, android.R.layout.simple_spinner_item,getDayData());
    //
    //      final List<String> sexList = getSexData();
    //      ArrayAdapter<String> sexAdapter = new ArrayAdapter<String>
    //            (RegisterActivity.this, android.R.layout.simple_spinner_item,getSexData());

    // ArrayAdapter??
    ArrayAdapter<String> yearAdapter = new ArrayAdapter<String>(RegisterActivity.this, R.layout.spinner_item,
            yearList) {
        @Override
        public View getDropDownView(int position, View convertView, ViewGroup parent) {
            LayoutInflater inflater = (LayoutInflater) getContext()
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            View view = inflater.inflate(R.layout.spinner_item_layout, null);
            TextView label = (TextView) view.findViewById(R.id.spinner_item_label);

            label.setText(yearList.get(position));

            return view;
            //return super.getDropDownView(position, convertView, parent);
        }
    };
    ArrayAdapter<String> monthAdapter = new ArrayAdapter<String>(RegisterActivity.this, R.layout.spinner_item,
            getMonthData()) {
        @Override
        public View getDropDownView(int position, View convertView, ViewGroup parent) {
            LayoutInflater inflater = (LayoutInflater) getContext()
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            View view = inflater.inflate(R.layout.spinner_item_layout, null);
            TextView label = (TextView) view.findViewById(R.id.spinner_item_label);

            label.setText(monthList.get(position));

            return view;
            //return super.getDropDownView(position, convertView, parent);
        }
    };
    ArrayAdapter<String> dayAdapter = new ArrayAdapter<String>(RegisterActivity.this, R.layout.spinner_item,
            getDayData()) {
        @Override
        public View getDropDownView(int position, View convertView, ViewGroup parent) {
            LayoutInflater inflater = (LayoutInflater) getContext()
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            View view = inflater.inflate(R.layout.spinner_item_layout, null);
            TextView label = (TextView) view.findViewById(R.id.spinner_item_label);

            label.setText(dayList.get(position));

            return view;
            //return super.getDropDownView(position, convertView, parent);
        }
    };

    final List<String> sexList = getSexData();
    ArrayAdapter<String> sexAdapter = new ArrayAdapter<String>(RegisterActivity.this, R.layout.spinner_item,
            getSexData()) {
        @Override
        public View getDropDownView(int position, View convertView, ViewGroup parent) {
            LayoutInflater inflater = (LayoutInflater) getContext()
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            View view = inflater.inflate(R.layout.spinner_item_layout, null);
            TextView label = (TextView) view.findViewById(R.id.spinner_item_label);

            label.setText(sexList.get(position));

            return view;
            //return super.getDropDownView(position, convertView, parent);
        }
    };

    //?
    yearAdapter.setDropDownViewResource(R.layout.spinner_item_layout);
    //?
    monthAdapter.setDropDownViewResource(R.layout.spinner_item_layout);
    //?
    dayAdapter.setDropDownViewResource(R.layout.spinner_item_layout);
    //?
    sexAdapter.setDropDownViewResource(R.layout.spinner_item_layout);

    year.setAdapter(yearAdapter);
    month.setAdapter(monthAdapter);
    day.setAdapter(dayAdapter);
    sex.setAdapter(sexAdapter);

    year.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View view, MotionEvent motionEvent) {

            Log.i(TAG, "year touch ");
            closeSoftKeyboard();
            return false;
        }
    });
    month.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View view, MotionEvent motionEvent) {

            Log.i(TAG, "year touch ");
            closeSoftKeyboard();
            return false;
        }
    });
    day.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View view, MotionEvent motionEvent) {

            Log.i(TAG, "year touch ");
            closeSoftKeyboard();
            return false;
        }
    });
    sex.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View view, MotionEvent motionEvent) {

            Log.i(TAG, "year touch ");
            closeSoftKeyboard();
            return false;
        }
    });

    getShared();
    setSpinner();

    regBtn.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            // TODO Auto-generated method stub
            if (usernameET.getText().toString().equals("")) {
                //               Toast.makeText(RegisterActivity.this, "??",
                //                     Toast.LENGTH_LONG).show();
                toastCommom.ToastShow(RegisterActivity.this, (ViewGroup) findViewById(R.id.toast_layout_root),
                        "??");
                return;
            }
            if (psdET.getText().toString().equals("")) {
                //               Toast.makeText(RegisterActivity.this, "?",
                //                     Toast.LENGTH_LONG).show();
                toastCommom.ToastShow(RegisterActivity.this, (ViewGroup) findViewById(R.id.toast_layout_root),
                        "?");
                return;
            }
            if (psdaET.getText().toString().equals("")) {
                //               Toast.makeText(RegisterActivity.this, "?",
                //                     Toast.LENGTH_LONG).show();
                toastCommom.ToastShow(RegisterActivity.this, (ViewGroup) findViewById(R.id.toast_layout_root),
                        "?");
                return;
            }
            if (!psdaET.getText().toString().equals(psdET.getText().toString())) {
                Log.v(TAG, "??");
                //               Toast.makeText(RegisterActivity.this, "??",
                //                     Toast.LENGTH_LONG).show();
                toastCommom.ToastShow(RegisterActivity.this, (ViewGroup) findViewById(R.id.toast_layout_root),
                        "??");
                return;
            }
            if (nameET.getText().toString().equals("")) {
                //               Toast.makeText(RegisterActivity.this, "??",
                //                     Toast.LENGTH_LONG).show();
                toastCommom.ToastShow(RegisterActivity.this, (ViewGroup) findViewById(R.id.toast_layout_root),
                        "??");
                return;
            }
            pDialog = new ProgressDialog(RegisterActivity.this);
            pDialog.setTitle("");
            pDialog.setMessage("?......");
            pDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
            pDialog.show();
            new RegisterThread().run();
        }
    });

    photoBtn.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            // TODO Auto-generated method stub
            picKind = 0;
            Intent intent = new Intent(RegisterActivity.this, SelectPictureActivity.class);
            intent.putExtra("from", "register");
            startActivityForResult(intent, REQUEST_PICK);

            //RegisterActivity.this.finish();
        }
    });

    signBtn.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            // TODO Auto-generated method stub
            picKind = 1;
            Intent intent = new Intent(RegisterActivity.this, SelectPictureActivity.class);
            intent.putExtra("from", "register");
            startActivityForResult(intent, REQUEST_PICK);
        }
    });

}

From source file:com.example.alyshia.customsimplelauncher.MainActivity.java

private void checkKioskEnabled() {
    Log.d(TAG, "checking kioskenabled");

    if (km == null) {
        km = KioskMode.getInstance(this);
    }//  www.ja v a  2 s  .  c om
    if (!km.isKioskModeEnabled()) {
        if (mDialog == null) {
            mDialog = new ProgressDialog(this, R.style.customDialog);
            mDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
            mDialog.setMessage("Please wait while applying user's setting");
            mDialog.setCancelable(false);
            mDialog.show();
        } else {
            if (!mDialog.isShowing()) {
                mDialog.show();
            }
        }
        String launchPackage = "com.example.alyshia.customsimplelauncher";
        km.enableKioskMode(launchPackage);
    } else {
    }
}

From source file:org.dvbviewer.controller.ui.fragments.TimerList.java

@Override
public void onAsyncActionStart() {
    progressDialog = new ProgressDialog(getActivity());
    progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    progressDialog.setMessage(getResources().getString(R.string.busyDeleteTimer));
    progressDialog.setIndeterminate(true);
    progressDialog.setCancelable(false);
    progressDialog.show();/*w ww .j a v  a2 s.co m*/
}

From source file:org.odk.collect.android.activities.GoogleDriveActivity.java

@Override
protected Dialog onCreateDialog(int id) {
    switch (id) {
    case PROGRESS_DIALOG:
        Collect.getInstance().getActivityLogger().logAction(this, "onCreateDialog.PROGRESS_DIALOG", "show");

        ProgressDialog progressDialog = new ProgressDialog(this);
        DialogInterface.OnClickListener loadingButtonListener = new DialogInterface.OnClickListener() {
            @Override//from  w w  w .  ja v a2s .co  m
            public void onClick(DialogInterface dialog, int which) {
                Collect.getInstance().getActivityLogger().logAction(this, "onCreateDialog.PROGRESS_DIALOG",
                        "cancel");
                dialog.dismiss();
                getFileTask.cancel(true);
                getFileTask.setGoogleDriveFormDownloadListener(null);
            }
        };
        progressDialog.setTitle(getString(R.string.downloading_data));
        progressDialog.setMessage(alertMsg);
        progressDialog.setIndeterminate(true);
        progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        progressDialog.setCancelable(false);
        progressDialog.setButton(getString(R.string.cancel), loadingButtonListener);
        return progressDialog;
    case GOOGLE_USER_DIALOG:
        AlertDialog.Builder gudBuilder = new AlertDialog.Builder(this);

        gudBuilder.setTitle(getString(R.string.no_google_account));
        gudBuilder.setMessage(getString(R.string.google_set_account));
        gudBuilder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                finish();
            }
        });
        gudBuilder.setCancelable(false);
        return gudBuilder.create();
    }
    return null;
}

From source file:com.slownet5.pgprootexplorer.filemanager.ui.FileManagerActivity.java

private void setupRoot() {
    if (alreadySetup()) {
        afterInitSetup(true);/*from w ww .  java  2 s  . com*/
        return;
    }
    final ProgressDialog dialog = new ProgressDialog(this);
    dialog.setIndeterminate(true);
    dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    dialog.setTitle("Setting up root");
    dialog.setCancelable(false);
    ;
    dialog.setMax(100);
    final String os = SystemUtils.getSystemArchitecture();
    Log.d(TAG, "setupRoot: architecture is: " + os);
    class Setup extends AsyncTask<Void, Integer, Boolean> {

        @Override
        protected Boolean doInBackground(Void... params) {
            new File(SharedData.CRYPTO_FM_PATH).mkdirs();
            String filename = SharedData.CRYPTO_FM_PATH + "/toybox";
            AssetManager asset = getAssets();
            try {

                InputStream stream = asset.open("toybox");

                OutputStream out = new FileOutputStream(filename);
                byte[] buffer = new byte[4096];
                int read;
                int total = 0;
                while ((read = stream.read(buffer)) != -1) {
                    total += read;
                    out.write(buffer, 0, read);
                }
                Log.d(TAG, "doInBackground: total written bytes: " + total);
                stream.close();
                out.flush();
                out.close();
            } catch (IOException ex) {
                ex.printStackTrace();
                return false;
            }
            RootUtils.initRoot(filename);

            return true;
        }

        @Override
        protected void onPreExecute() {
            dialog.setMessage("Please wait....");
            dialog.show();
        }

        @Override
        protected void onPostExecute(Boolean aBoolean) {
            dialog.dismiss();
            if (aBoolean) {
                SharedPreferences.Editor prefs = getSharedPreferences(CommonConstants.COMMON_SHARED_PEREFS_NAME,
                        Context.MODE_PRIVATE).edit();
                prefs.putBoolean(CommonConstants.ROOT_TOYBOX, true);
                prefs.apply();
                prefs.commit();
                afterInitSetup(true);

            } else {
                afterInitSetup(aBoolean);
            }
        }
    }
    new Setup().execute();
}

From source file:org.dvbviewer.controller.ui.fragments.RecordingList.java

@Override
public void onAsyncActionStart() {
    progressDialog = new ProgressDialog(getActivity());
    progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    progressDialog.setMessage(getResources().getString(R.string.busyDeleteRecordings));
    progressDialog.setIndeterminate(true);
    progressDialog.setCancelable(false);
    progressDialog.show();//from w  w w.ja  v a 2 s. c om
}