sample/src/main/java/net/rdrei/android/dirchooser/sample/DirChooserSample.java
@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        mDirectoryTextView = (TextView) findViewById(R.id.textDirectory);

        // Set up click handler for "Choose Directory" button
        findViewById(R.id.btnChoose)
                .setOnClickListener(new OnClickListener() {

                    @Override
                    public void onClick(View v) {
                        final Intent chooserIntent = new Intent(
                                DirChooserSample.this,
                                DirectoryChooserActivity.class);

                        final DirectoryChooserConfig config = DirectoryChooserConfig.builder()
                                .newDirectoryName("DirChooserSample")
                                .allowReadOnlyDirectory(true)
                                .allowNewDirectoryNameModification(true)
                                .build();

                        chooserIntent.putExtra(
                                DirectoryChooserActivity.EXTRA_CONFIG,
                                config);

                        startActivityForResult(chooserIntent, REQUEST_DIRECTORY);
                    }
                });

        findViewById(R.id.btnChange)
                .setOnClickListener(new OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        final Intent fragmentSampleIntent = new Intent(
                                DirChooserSample.this,
                                DirChooserFragmentSample.class
                        );

                        startActivity(fragmentSampleIntent);
                    }
                });
    }
@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        mDirectoryTextView = (TextView) findViewById(R.id.textDirectory);

        // Set up click handler for "Choose Directory" button
        findViewById(R.id.btnChoose)
                .setOnClickListener(new OnClickListener() {

                    @Override
                    public void onClick(View v) {
                        final Intent chooserIntent = new Intent(
                                DirChooserSample.this,
                                DirectoryChooserActivity.class);

                        final DirectoryChooserConfig config = DirectoryChooserConfig.builder()
                                .newDirectoryName("DirChooserSample")
                                .allowReadOnlyDirectory(true)
                                .allowNewDirectoryNameModification(true)
                                .build();

                        chooserIntent.putExtra(
                                DirectoryChooserActivity.EXTRA_CONFIG,
                                config);

                        startActivityForResult(chooserIntent, REQUEST_DIRECTORY);
                    }
                });

        findViewById(R.id.btnChange)
                .setOnClickListener(new OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        final Intent fragmentSampleIntent = new Intent(
                                DirChooserSample.this,
                                DirChooserFragmentSample.class
                        );

                        startActivity(fragmentSampleIntent);
                    }
                });
    }
Called when the activity is first created.