Source:
public Dialog onCreateDialog(Bundle savedInstanceState) { super.onCreateDialog(savedInstanceState); mActivity = (RepoListActivity) getActivity(); AlertDialog.Builder builder = new AlertDialog.Builder(mActivity); LayoutInflater inflater = mActivity.getLayoutInflater(); View layout = inflater.inflate(R.layout.dialog_clone, null); builder.setView(layout); mRemoteURL = (EditText) layout.findViewById(R.id.remoteURL); mLocalPath = (EditText) layout.findViewById(R.id.localPath); mUsername = (EditText) layout.findViewById(R.id.username); mPassword = (EditText) layout.findViewById(R.id.password); mIsSavePassword = (CheckBox) layout.findViewById(R.id.savePassword); mCloneRecursive = (CheckBox) layout.findViewById(R.id.cloneRecursive); if ( Profile.hasLastCloneFailed() ) fillInformationFromPreviousCloneFail( Profile.getLastCloneTryRepo() ); if (Constants.DEBUG) { mRemoteURL.setText(Repo.TEST_REPO); mLocalPath.setText(Repo.TEST_LOCAL); } mRemoteURL.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean hasFocus) { if (!hasFocus) { final String remoteUrl = mRemoteURL.getText().toString(); final int lastSlash = remoteUrl.lastIndexOf("/"); final String localHint = remoteUrl.substring(lastSlash + 1); if (!localHint.equals("") && lastSlash != -1) { mLocalPath.setHint(localHint); } } } }); builder.setTitle(R.string.title_clone_repo); builder.setNegativeButton(R.string.label_cancel, new DummyDialogListener()); builder.setNeutralButton(R.string.dialog_clone_neutral_label, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { InitDialog id = new InitDialog(); id.show(getFragmentManager(), "init-dialog"); } }); builder.setPositiveButton(R.string.label_clone, new DummyDialogListener()); return builder.create(); }

Target:
public Dialog onCreateDialog(Bundle savedInstanceState) { super.onCreateDialog(savedInstanceState); mActivity = (RepoListActivity) getActivity(); AlertDialog.Builder builder = new AlertDialog.Builder(mActivity); LayoutInflater inflater = mActivity.getLayoutInflater(); View layout = inflater.inflate(R.layout.dialog_clone, null); builder.setView(layout); mRemoteURL = (EditText) layout.findViewById(R.id.remoteURL); mLocalPath = (EditText) layout.findViewById(R.id.localPath); mUsername = (EditText) layout.findViewById(R.id.username); mPassword = (EditText) layout.findViewById(R.id.password); mIsSavePassword = (CheckBox) layout.findViewById(R.id.savePassword); mCloneRecursive = (CheckBox) layout.findViewById(R.id.cloneRecursive); if ( Profile.hasLastCloneFailed() ) fillInformationFromPreviousCloneFail( Profile.getLastCloneTryRepo() ); if (Constants.DEBUG) { mRemoteURL.setText(Repo.TEST_REPO); mLocalPath.setText(Repo.TEST_LOCAL); } mRemoteURL.setOnFocusChangeListener(new RemoteUrlFocusListener()); builder.setTitle(R.string.title_clone_repo); builder.setNegativeButton(R.string.label_cancel, new DummyDialogListener()); builder.setNeutralButton(R.string.dialog_clone_neutral_label, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { InitDialog id = new InitDialog(); id.show(getFragmentManager(), "init-dialog"); } }); builder.setPositiveButton(R.string.label_clone, new DummyDialogListener()); return builder.create(); }