public class CreateHomeScreenShortcut extends DialogFragment {
// The public interface is used to send information back to the parent activity.
public interface CreateHomeScreenSchortcutListener {
public class CreateHomeScreenShortcut extends DialogFragment {
// The public interface is used to send information back to the parent activity.
public interface CreateHomeScreenSchortcutListener {
LayoutInflater customDialogInflater = getActivity().getLayoutInflater();
// Use AlertDialog.Builder to create the AlertDialog. The style formats the color of the button text.
LayoutInflater customDialogInflater = getActivity().getLayoutInflater();
// Use AlertDialog.Builder to create the AlertDialog. The style formats the color of the button text.
- AlertDialog.Builder createHomeScreenShorcutDialogBuilder = new AlertDialog.Builder(getActivity(), R.style.LightAlertDialog);
- createHomeScreenShorcutDialogBuilder.setTitle(R.string.create_shortcut);
- createHomeScreenShorcutDialogBuilder.setIcon(favoriteIconDrawable);
+ AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.LightAlertDialog);
+ dialogBuilder.setTitle(R.string.create_shortcut);
+ dialogBuilder.setIcon(favoriteIconDrawable);
assert shortcutNameEditText != null; // Remove the warning below that shortcutNameEditText might be null.
shortcutNameEditText.setOnKeyListener(new View.OnKeyListener() {
public boolean onKey(View v, int keyCode, KeyEvent event) {
// If the event is a key-down on the "enter" button, select the PositiveButton "Create".
if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) {
// Trigger the create listener.
assert shortcutNameEditText != null; // Remove the warning below that shortcutNameEditText might be null.
shortcutNameEditText.setOnKeyListener(new View.OnKeyListener() {
public boolean onKey(View v, int keyCode, KeyEvent event) {
// If the event is a key-down on the "enter" button, select the PositiveButton "Create".
if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) {
// Trigger the create listener.