Dialog 관련




showDialog(DIALOG_CREATE_SHORTCUT); 라고 부르면

자동으로

protected Dialog onCreateDialog(int id) {
        switch (id) {
            case DIALOG_CREATE_SHORTCUT:
                return new CreateShortcut().createDialog();
            case DIALOG_RENAME_FOLDER:
                return new RenameFolder().createDialog();
        }

        return super.onCreateDialog(id);
    }

이 불린다.

onCreateDialog() 가 불리기 전에 onPrepareDialog() 가 불린다...

여기서 뭔가를 해줘서 바꿀 수 있는 듯.


 protected void onPrepareDialog(int id, Dialog dialog) {
        switch (id) {
            case DIALOG_CREATE_SHORTCUT:
                break;
            case DIALOG_RENAME_FOLDER:
                if (mFolderInfo != null) {
                    EditText input = (EditText) dialog.findViewById(R.id.folder_name);
                    final CharSequence text = mFolderInfo.title;
                    input.setText(text);
                    input.setSelection(0, text.length());
                }
                break;
        }
    }


public final void showDialog (int id)

Since: API Level 1

Show a dialog managed by this activity. A call to onCreateDialog(int) will be made with the same id the first time this is called for a given id. From thereafter, the dialog will be automatically saved and restored. Each time a dialog is shown,onPrepareDialog(int, Dialog) will be made to provide an opportunity to do any timely preparation.

Parameters
idThe id of the managed dialog.



protected Dialog onCreateDialog (int id)

Since: API Level 1

Callback for creating dialogs that are managed (saved and restored) for you by the activity. If you use showDialog(int), the activity will call through to this method the first time, and hang onto it thereafter. Any dialog that is created by this method will automatically be saved and restored for you, including whether it is showing. If you would like the activity to manage the saving and restoring dialogs for you, you should override this method and handle any ids that are passed to showDialog(int). If you would like an opportunity to prepare your dialog before it is shown, override onPrepareDialog(int, Dialog).

Parameters
idThe id of the dialog.
Returns
  • The dialog


rotected void onPrepareDialog (int id, Dialog dialog)

Since: API Level 1

Provides an opportunity to prepare a managed dialog before it is being shown.

Override this if you need to update a managed dialog based on the state of the application each time it is shown. For example, a time picker dialog might want to be updated with the current time. You should call through to the superclass's implementation. The default implementation will set this Activity as the owner activity on the Dialog.

Parameters
idThe id of the managed dialog.
dialogThe dialog.



public final void dismissDialog (int id)

Since: API Level 1

Dismiss a dialog that was previously shown via showDialog(int).

Parameters
idThe id of the managed dialog.
Throws
IllegalArgumentExceptionif the id was not previously shown via showDialog(int).


public final void removeDialog (int id)

Since: API Level 1

Removes any internal references to a dialog managed by this Activity. If the dialog is showing, it will dismiss it as part of the clean up. This can be useful if you know that you will never show a dialog again and want to avoid the overhead of saving and restoring it in the future.

Parameters
idThe id of the managed dialog.







by 수영사랑 | 2009/12/30 18:03 | Android APIs | 트랙백 | 덧글(0)

트랙백 주소 : http://skyswim42.egloos.com/tb/3513080
☞ 내 이글루에 이 글과 관련된 글 쓰기 (트랙백 보내기) [도움말]

:         :

:

비공개 덧글

◀ 이전 페이지다음 페이지 ▶