FileDocCategorySizeDatePackage
CreateDirectoryFragment.javaAPI DocAndroid 5.1 API4909Thu Mar 12 22:22:40 GMT 2015com.android.documentsui

CreateDirectoryFragment

public class CreateDirectoryFragment extends android.app.DialogFragment
Dialog to create a new directory.

Fields Summary
private static final String
TAG_CREATE_DIRECTORY
Constructors Summary
Methods Summary
public android.app.DialogonCreateDialog(android.os.Bundle savedInstanceState)

        final Context context = getActivity();
        final ContentResolver resolver = context.getContentResolver();

        final AlertDialog.Builder builder = new AlertDialog.Builder(context);
        final LayoutInflater dialogInflater = LayoutInflater.from(builder.getContext());

        final View view = dialogInflater.inflate(R.layout.dialog_create_dir, null, false);
        final EditText text1 = (EditText) view.findViewById(android.R.id.text1);

        builder.setTitle(R.string.menu_create_dir);
        builder.setView(view);

        builder.setPositiveButton(android.R.string.ok, new OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                final String displayName = text1.getText().toString();

                final DocumentsActivity activity = (DocumentsActivity) getActivity();
                final DocumentInfo cwd = activity.getCurrentDirectory();

                new CreateDirectoryTask(activity, cwd, displayName).executeOnExecutor(
                        ProviderExecutor.forAuthority(cwd.authority));
            }
        });
        builder.setNegativeButton(android.R.string.cancel, null);

        return builder.create();
    
public static voidshow(android.app.FragmentManager fm)


         
        final CreateDirectoryFragment dialog = new CreateDirectoryFragment();
        dialog.show(fm, TAG_CREATE_DIRECTORY);