- ((Button)v.findViewById(R.id.cancel)).setOnClickListener(this);
- ((Button)v.findViewById(R.id.ok)).setOnClickListener(this);
- ((TextView)v.findViewById(R.id.user_input)).setText(currentName);
- ((TextView)v.findViewById(R.id.user_input)).requestFocus();
- getDialog().getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE);
+ // Inflate the layout for the dialog
+ LayoutInflater inflater = getSherlockActivity().getLayoutInflater();
+ View v = inflater.inflate(R.layout.edit_box_dialog, null); // null parent view because it will go in the dialog layout
+ TextView inputText = ((TextView)v.findViewById(R.id.user_input));
+ inputText.setText(currentName);
+
+ // Set it to the dialog
+ AlertDialog.Builder builder = new AlertDialog.Builder(getSherlockActivity());
+ builder.setView(v)
+ .setPositiveButton(R.string.common_ok, this)
+ .setNegativeButton(R.string.common_cancel, this);