Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected static TextView GroupName;
- protected static EditText rename_dialog_edit;
- in onCreateView:
- GroupName = (TextView) view.findViewById(R.id.group_details_name);
- rename_dialog_edit = (EditText) view.findViewById(R.id.groupdetails_rename);
- void showDialog() {
- DialogFragment newFragment = MyAlertDialogFragment
- .newInstance(R.string.groupDetails_rename);
- newFragment.show(getFragmentManager(), "dialog");
- }
- public static void doPositiveClick() {
- GroupName.setText(rename_dialog_edit.getText().toString());
- //Log.i("FragmentAlertDialog", "Positive click!");
- }
- public static void doNegativeClick() {
- //Log.i("FragmentAlertDialog", "Negative click!");
- }
- public static class MyAlertDialogFragment extends DialogFragment {
- public static MyAlertDialogFragment newInstance(int title) {
- MyAlertDialogFragment frag = new MyAlertDialogFragment();
- Bundle args = new Bundle();
- args.putInt("title", title);
- frag.setArguments(args);
- return frag;
- }
- @Override
- public Dialog onCreateDialog(Bundle savedInstanceState) {
- AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
- LayoutInflater inflater = getActivity().getLayoutInflater();
- //int title = getArguments().getInt("title");
- return builder.setView(inflater.inflate(R.layout.group_details_rename_dialog, null))
- //.setIcon(R.drawable.logo)
- //.setTitle(R.string.groupDetails_rename)
- .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int id) {
- doPositiveClick();
- }
- })
- .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialog, int id) {
- doNegativeClick();
- }
- })
- .create();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment