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();