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:com.osama.cryptofm.tasks.DecryptTask.java

@Override
protected void onPreExecute() {
    if (singleFileMode) {
        singleModeDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        singleModeDialog.setTitle("Decrypting file");
        singleModeDialog.setMessage("Please wait while I finish decrypting file");
        singleModeDialog.setIndeterminate(true);
        singleModeDialog.show();/*w  w  w .j  a v  a2s .co m*/
        return;
    }
    mProgressDialog.show();
}

From source file:com.googlecode.android_scripting.facade.ui.UiFacade.java

@Rpc(description = "Create a spinner progress dialog.")
public void dialogCreateSpinnerProgress(@RpcParameter(name = "title") @RpcOptional String title,
        @RpcParameter(name = "message") @RpcOptional String message,
        @RpcParameter(name = "maximum progress") @RpcDefault("100") Integer max) {
    dialogDismiss(); // Dismiss any existing dialog.
    mDialogTask = new ProgressDialogTask(ProgressDialog.STYLE_SPINNER, max, title, message, true);
}

From source file:com.sssemil.sonyirremote.ir.ir.java

public void learnAction(final String filename) {
    mProgressDialog = new ProgressDialog(ir.this);
    mProgressDialog.setMessage(getString(R.string.waiting_for_signal));
    mProgressDialog.setIndeterminate(true);
    mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    mProgressDialog.show();//w  ww  .  java2  s . c  o  m
    new Thread(new Runnable() {
        public void run() {
            mProgressDialog.show();
            restartIR();
            state = learnKey(filename);
            if (state < 0) {
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        errorT(getString(R.string.failed_lk) + filename);
                    }
                });
            }
            mProgressDialog.cancel();
        }
    }).start();
}

From source file:com.jbsoft.farmtotable.FarmToTableActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    progress = new ProgressDialog(this);
    super.onCreate(savedInstanceState);

    if (readyToGo()) {
        setContentView(R.layout.activity_main);

        SupportMapFragment mapFrag = (SupportMapFragment) getSupportFragmentManager()
                .findFragmentById(R.id.map);

        initListNav();//from   w w w . j av a  2s.  com

        getSupportActionBar().setHomeButtonEnabled(true);
        sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
        getPreferences(sharedPrefs);

        sharedPrefs.registerOnSharedPreferenceChangeListener(listener);

        map = mapFrag.getMap();
        locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
        // Getting GPS status
        boolean isNETWORKEnabled = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
        boolean isGPSEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
        // If GPS enabled, get latitude/longitude using GPS Services

        if (isGPSEnabled) {
            locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, MIN_TIME_BW_UPDATES,
                    MIN_DISTANCE_CHANGE_FOR_UPDATES, gpsLocationListener);
            Log.d("GPS Enabled", "GPS Enabled");
            if (locationManager != null) {
                location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
                if (location != null) {
                    latitude = location.getLatitude();
                    longitude = location.getLongitude();
                }
            }
        }

        if (savedInstanceState == null) {

            CameraUpdate center = CameraUpdateFactory.newLatLng(new LatLng(latitude, longitude));
            map.moveCamera(center);
        }

        if (NOFM) {
            //Reverse geocoder to zipcode
            getZipFromLocation(location, this);

            //start progress box going
            //Call api to retrieve Farmers Market from the UDSA site 
            usdaurl = usdaurl + zipcode;
        } else {
            nozip = true;
        }
        //start progress box going
        progress.setMessage("Getting Farmers Markets and Other Organic Options in your area:)");
        progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        progress.setIndeterminate(true);
        progress.show();
        gplaceurl = placeurl_save;
        placeurl_save = gplaceurl;
        if (NOVR) {
            gplaceurl = gplaceurl + queryvegan;
        }

        if (NOOR) {
            gplaceurl = placeurl_save;
            gplaceurl = gplaceurl + queryvegetarian;
        }

        if (NOFS) {
            gplaceurl = placeurl_save;
            gplaceurl = gplaceurl + queryfarms;
        }

        if ((NOVR) && (NOOR)) {
            gplaceurl = placeurl_save;
            gplaceurl = gplaceurl + queryvegan + "&" + queryvegetarian;
        }

        if ((NOVR) && (NOFS)) {
            gplaceurl = placeurl_save;
            gplaceurl = gplaceurl + queryvegan + "&" + queryfarms;
        }

        if ((NOOR) && (NOFS)) {
            gplaceurl = placeurl_save;
            gplaceurl = gplaceurl + queryvegetarian + "&" + queryfarms;
        }

        if ((NOVR) && (NOOR) && (NOFS)) {
            gplaceurl = placeurl_save;
            gplaceurl = gplaceurl + queryvegan + "&" + queryvegetarian + "&" + queryfarms;
        }

        //The Google Places API Text Search Service 
        gplaceurl = gplaceurl + "&location=" + latitude + "," + longitude
                + "&radius=10&key=AIzaSyA_fzl-7ZkF4EINWhuQ0bcXp3zkdAXZc5o";
        //Call Asynch process Api 

        new restAPICall().execute(usdaurl, gplaceurl);
    }

    map.setInfoWindowAdapter(new CustomToast(this, null));
    // map.setOnInfoWindowClickListener((OnInfoWindowClickListener) 
    map.setMyLocationEnabled(true);
    CameraUpdate zoom = CameraUpdateFactory.zoomTo(12);
    map.animateCamera(zoom);
}

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

/**
 * kicks off the actual signing process on a background thread
 *///ww w .j  a  va 2  s .  c  o m
private void startSigning() {

    // 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_CERTIFY_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:fr.gcastel.freeboxV6GeekIncDownloader.services.FreeboxDownloaderService.java

public void attach(Context inContext) {
    zeContext = inContext;//from   w  w  w  .j av  a 2  s .  c  o  m
    switch (dialogueEnCours) {
    case PROGRESS:
        dialog = new ProgressDialog(zeContext);
        dialog.setCancelable(true);
        ((ProgressDialog) dialog).setMessage("Connexion  la freebox");
        ((ProgressDialog) dialog).setProgressStyle(ProgressDialog.STYLE_SPINNER);
        dialog.show();
        break;
    case ALERT:
        prepareAlertDialog(alertDialogMessage);
        showAlertDialog();
        break;
    case NONE:
    default:
        break;
    }
}

From source file:com.coincollection.MainActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.main_activity_layout);

    mBuilder = new AlertDialog.Builder(this);
    mRes = getResources();//from  www. j av  a  2 s .c om

    // Check whether it is the users first time using the app
    final SharedPreferences mainPreferences = getSharedPreferences(MainApplication.PREFS, MODE_PRIVATE);

    // In legacy code we used first_Time_screen2 here so that the message would be displayed
    // until they made it to the create collection screen.  That isn't necessary anymore, but
    // if they are upgrading from that don't show them the help screen if first_Time_screen1
    // isn't set
    if (mainPreferences.getBoolean("first_Time_screen1", true)
            && mainPreferences.getBoolean("first_Time_screen2", true)) {
        // Show the user how to do everything
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setMessage(mRes.getString(R.string.intro_message)).setCancelable(false)
                .setPositiveButton(mRes.getString(R.string.okay), new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        dialog.cancel();
                        SharedPreferences.Editor editor = mainPreferences.edit();
                        editor.putBoolean("first_Time_screen1", false);
                        editor.commit(); // .apply() in later APIs
                    }
                });
        AlertDialog alert = builder.create();
        alert.show();
    }

    InitTask check = (InitTask) getLastCustomNonConfigurationInstance();

    // TODO If there is a screen orientation change, it looks like a ProgressDialog gets leaked. :(
    if (check == null) {

        if (BuildConfig.DEBUG) {
            Log.d(MainApplication.APP_NAME, "No previous state so kicking off InitTask to doOpen");
        }

        // Kick off the InitTask to open the database.  This will likely be the first open,
        // so we want it in the AsyncTask in case we have to go into onUpgrade and it takes
        // a long time.

        mTask = new InitTask();

        mTask.doOpen = true;
        mTask.activity = this;

        mTask.execute();

        // The InitTask will call finishViewSetup once the database has been opened
        // for the first time

    } else {

        if (BuildConfig.DEBUG) {
            Log.d(MainApplication.APP_NAME, "Taking over existing mTask");
        }

        // an InitTask is running, make a new dialog to show it
        mTask = check;
        mTask.activity = this;

        // There's two possible InitTask's that could be running:
        //     - The one to open the database for the first time
        //     - The one to import collections
        // In the case of the former, we just want to show the dialog that the user had on the
        // screen.  For the latter case, we still need something to call finishViewSetup, and
        // we don't want to call it here bc it will try to use the database too early.  Instead,
        // set a flag that will have that InitTask call finishViewSetup for us as well.

        if (mProgressDialog != null && mProgressDialog.isShowing()) {
            mProgressDialog.dismiss();
        }

        String message = mTask.openMessage;

        if (mTask.doImport) {
            message = mTask.importMessage;

            mDatabaseHasBeenOpened = true; // This has to have happened at this point
            mIsImportingCollection = true;
            mShouldFinishViewSetupToo = true;
        }
        // Make a new dialog

        mProgressDialog = new ProgressDialog(mContext);
        mProgressDialog.setCancelable(false);
        mProgressDialog.setMessage(message);
        mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        mProgressDialog.setProgress(0);
        mProgressDialog.show();

    }

    // HISTORIC - no longer the case:
    //
    // We need to open the database since we are the first activity to run
    // We only want to open the database once, though, because it is a hassle
    // in that it is very expensive and must be opened in an asynchronous mTask
    // background thread as to avoid getting application not responding errors.
    // So, here is what we do:
    // - Instantiate a Service that will hold the database adapter
    //    + This will be around for the lifetime of the application
    // - Once the service has been created, open up the database in an async mTask
    // - Once the database is open, finish setting up the UI from the data pulled

    // After we open it, it must have at least one activity bound to it at all times
    // for it to stay alive.  So, each activity must bind to it on onCreate and
    // unbind in onDestroy.  Once the app is terminating, all the activity onDestroy's
    // will have been called and the service's onDestroy will then get called, where
    // we close the databse

    // Actually instantiate the database service
    //Intent mServiceIntent = new Intent(this, DatabaseService.class);
    // and bind to it
    //bindService(mServiceIntent, mConnection, Context.BIND_AUTO_CREATE);
    //
    // Having the database open for a long time didn't seem to work out well, though - after
    // having the app open for a while, database errors would start popping up.  Now, we just
    // do the first DB open in an AsyncTask to ensure we don't get an ANR if a database upgrade
    // is required, but just open and close the database regularly as needed after that.
}

From source file:potboiler.client.PotsActivity.java

License:asdf

private void initDlg() {
    mProgressDialog = new ProgressDialog(this);
    mProgressDialog.setCancelable(false);
    mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    mProgressDialog.setMessage("? ...");
}

From source file:com.mobicage.rogerthat.plugins.messaging.widgets.PhotoUploadWidget.java

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == Crop.REQUEST_CROP) {
        handleCrop(resultCode, data);//  w  ww . j a v  a2s .c o  m
    } else if (requestCode == PICK_IMAGE) {
        if (resultCode == Activity.RESULT_OK) {
            if (data != null && data.getData() != null) {
                if (mRatio == null) {
                    final Uri selectedImage = data.getData();

                    final ProgressDialog progressDialog = new ProgressDialog(mActivity);
                    progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
                    progressDialog.setMessage(mActivity.getString(R.string.processing));
                    progressDialog.setCancelable(false);
                    progressDialog.show();

                    new SafeAsyncTask<Object, Object, Boolean>() {
                        @Override
                        protected Boolean safeDoInBackground(Object... params) {
                            L.d("Processing picture: " + selectedImage.getPath());
                            try {
                                File tmpUploadFile = getTmpUploadPhotoLocation();
                                if (tmpUploadFile.getAbsolutePath().equals(selectedImage.getPath())) {
                                    return true;
                                } else {
                                    InputStream is = mActivity.getContentResolver()
                                            .openInputStream(selectedImage);
                                    if (is != null) {
                                        try {
                                            OutputStream out = new FileOutputStream(tmpUploadFile);
                                            try {
                                                IOUtils.copy(is, out, 1024);
                                            } finally {
                                                out.close();
                                            }
                                        } finally {
                                            is.close();
                                        }
                                        return true;
                                    }
                                }
                            } catch (FileNotFoundException e) {
                                L.d(e);
                            } catch (Exception e) {
                                L.bug("Unknown exception occured while processing picture: "
                                        + selectedImage.toString(), e);
                            }

                            return false;
                        };

                        @Override
                        protected void safeOnPostExecute(Boolean result) {
                            progressDialog.dismiss();
                            if (result) {
                                handleSelection();
                            } else {
                                UIUtils.showLongToast(getContext(), R.string.crop__pick_error);
                            }
                        }

                        @Override
                        protected void safeOnCancelled(Boolean result) {
                        }

                        @Override
                        protected void safeOnProgressUpdate(Object... values) {
                        }

                        @Override
                        protected void safeOnPreExecute() {
                        };
                    }.execute();

                } else {
                    beginCrop(data.getData());
                    return;
                }
            } else {
                if (mRatio == null) {
                    handleSelection();
                } else {
                    beginCrop(mUriSavedImage);
                }
            }
        }
    } else {
        L.bug("Unexpected request code in onActivityResult: " + requestCode);
    }
}

From source file:org.gateshipone.odyssey.activities.OdysseyMainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    // restore drag state
    if (savedInstanceState != null) {
        mSavedNowPlayingDragStatus = DRAG_STATUS.values()[savedInstanceState
                .getInt(MAINACTIVITY_SAVED_INSTANCE_NOW_PLAYING_DRAG_STATUS)];
        mSavedNowPlayingViewSwitcherStatus = VIEW_SWITCHER_STATUS.values()[savedInstanceState
                .getInt(MAINACTIVITY_SAVED_INSTANCE_NOW_PLAYING_VIEW_SWITCHER_CURRENT_VIEW)];
    }/*from w  ww.j  a v a  2s .  com*/

    // Read theme preference
    SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
    String themePref = sharedPref.getString(getString(R.string.pref_theme_key),
            getString(R.string.pref_theme_default));
    boolean darkTheme = sharedPref.getBoolean(getString(R.string.pref_dark_theme_key),
            getResources().getBoolean(R.bool.pref_theme_dark_default));
    if (darkTheme) {
        if (themePref.equals(getString(R.string.pref_indigo_key))) {
            setTheme(R.style.AppTheme_indigo);
        } else if (themePref.equals(getString(R.string.pref_orange_key))) {
            setTheme(R.style.AppTheme_orange);
        } else if (themePref.equals(getString(R.string.pref_deeporange_key))) {
            setTheme(R.style.AppTheme_deepOrange);
        } else if (themePref.equals(getString(R.string.pref_blue_key))) {
            setTheme(R.style.AppTheme_blue);
        } else if (themePref.equals(getString(R.string.pref_darkgrey_key))) {
            setTheme(R.style.AppTheme_darkGrey);
        } else if (themePref.equals(getString(R.string.pref_brown_key))) {
            setTheme(R.style.AppTheme_brown);
        } else if (themePref.equals(getString(R.string.pref_lightgreen_key))) {
            setTheme(R.style.AppTheme_lightGreen);
        } else if (themePref.equals(getString(R.string.pref_red_key))) {
            setTheme(R.style.AppTheme_red);
        }
    } else {
        if (themePref.equals(getString(R.string.pref_indigo_key))) {
            setTheme(R.style.AppTheme_indigo_light);
        } else if (themePref.equals(getString(R.string.pref_orange_key))) {
            setTheme(R.style.AppTheme_orange_light);
        } else if (themePref.equals(getString(R.string.pref_deeporange_key))) {
            setTheme(R.style.AppTheme_deepOrange_light);
        } else if (themePref.equals(getString(R.string.pref_blue_key))) {
            setTheme(R.style.AppTheme_blue_light);
        } else if (themePref.equals(getString(R.string.pref_darkgrey_key))) {
            setTheme(R.style.AppTheme_darkGrey_light);
        } else if (themePref.equals(getString(R.string.pref_brown_key))) {
            setTheme(R.style.AppTheme_brown_light);
        } else if (themePref.equals(getString(R.string.pref_lightgreen_key))) {
            setTheme(R.style.AppTheme_lightGreen_light);
        } else if (themePref.equals(getString(R.string.pref_red_key))) {
            setTheme(R.style.AppTheme_red_light);
        }
    }
    if (themePref.equals(getString(R.string.pref_oleddark_key))) {
        setTheme(R.style.AppTheme_oledDark);
    }

    // Read default view preference
    String defaultView = sharedPref.getString(getString(R.string.pref_start_view_key),
            getString(R.string.pref_view_default));

    // the default tab for mymusic
    MyMusicFragment.DEFAULTTAB defaultTab = MyMusicFragment.DEFAULTTAB.ALBUMS;
    // the nav ressource id to mark the right item in the nav drawer
    int navId = -1;

    if (defaultView.equals(getString(R.string.pref_view_my_music_artists_key))) {
        navId = R.id.nav_my_music;
        defaultTab = MyMusicFragment.DEFAULTTAB.ARTISTS;
    } else if (defaultView.equals(getString(R.string.pref_view_my_music_albums_key))) {
        navId = R.id.nav_my_music;
        defaultTab = MyMusicFragment.DEFAULTTAB.ALBUMS;
    } else if (defaultView.equals(getString(R.string.pref_view_my_music_tracks_key))) {
        defaultTab = MyMusicFragment.DEFAULTTAB.TRACKS;
    } else if (defaultView.equals(getString(R.string.pref_view_playlists_key))) {
        navId = R.id.nav_saved_playlists;
    } else if (defaultView.equals(getString(R.string.pref_view_bookmarks_key))) {
        navId = R.id.nav_bookmarks;
    } else if (defaultView.equals(getString(R.string.pref_view_files_key))) {
        navId = R.id.nav_files;
    }

    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_odyssey_main);

    // restore elevation behaviour as pre 24 support lib
    AppBarLayout layout = (AppBarLayout) findViewById(R.id.appbar);
    layout.setStateListAnimator(null);
    ViewCompat.setElevation(layout, 0);

    // get fileexplorerhelper
    mFileExplorerHelper = FileExplorerHelper.getInstance();

    // setup progressdialog
    mProgressDialog = new ProgressDialog(OdysseyMainActivity.this);
    mProgressDialog.setMessage(getString(R.string.playbackservice_working));
    mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    mProgressDialog.setIndeterminate(true);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    // enable back navigation
    final android.support.v7.app.ActionBar actionBar = getSupportActionBar();

    if (actionBar != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    if (drawer != null) {
        mDrawerToggle = new ActionBarDrawerToggle(this, drawer, R.string.navigation_drawer_open,
                R.string.navigation_drawer_close);
        drawer.addDrawerListener(mDrawerToggle);
        mDrawerToggle.syncState();
    }

    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    if (navigationView != null) {
        navigationView.setNavigationItemSelectedListener(this);
        navigationView.setCheckedItem(navId);
    }

    // register context menu for currentPlaylistListView
    ListView currentPlaylistListView = (ListView) findViewById(R.id.list_linear_listview);
    registerForContextMenu(currentPlaylistListView);

    if (findViewById(R.id.fragment_container) != null) {
        if (savedInstanceState != null) {
            return;
        }

        Fragment fragment;

        switch (navId) {
        case R.id.nav_my_music:
            fragment = new MyMusicFragment();

            Bundle args = new Bundle();
            args.putInt(MyMusicFragment.MY_MUSIC_REQUESTED_TAB, defaultTab.ordinal());

            fragment.setArguments(args);
            break;
        case R.id.nav_saved_playlists:
            fragment = new SavedPlaylistsFragment();
            break;
        case R.id.nav_bookmarks:
            fragment = new BookmarksFragment();
            break;
        case R.id.nav_files:
            fragment = new FilesFragment();

            // open the default directory
            List<String> storageVolumesList = mFileExplorerHelper.getStorageVolumes(getApplicationContext());

            String defaultDirectory = "/";

            if (!storageVolumesList.isEmpty()) {
                // choose the latest used storage volume as default
                defaultDirectory = sharedPref.getString(getString(R.string.pref_file_browser_root_dir_key),
                        storageVolumesList.get(0));
            }

            args = new Bundle();
            args.putString(FilesFragment.ARG_DIRECTORYPATH, defaultDirectory);
            args.putBoolean(FilesFragment.ARG_ISROOTDIRECTORY, storageVolumesList.contains(defaultDirectory));

            fragment.setArguments(args);
            break;
        default:
            fragment = new MyMusicFragment();

            args = new Bundle();
            args.putInt(MyMusicFragment.MY_MUSIC_REQUESTED_TAB, defaultTab.ordinal());

            fragment.setArguments(args);
        }

        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
        transaction.replace(R.id.fragment_container, fragment);
        transaction.commit();
    }

    // ask for permissions
    requestPermissionExternalStorage();
}