프로그램/안드로이드

안드로이드에서 다이얼로그를 중첩해서 쓸 수 있을까? 화면 진행은 중단될까?

(주)CKBcorp., 2014. 7. 22. 06:00
반응형



말 그대로다. 

이거 잘 몰라서 테스트 코드로 검증해 봤는데, 다른 사람들도 아리까리 할 거 같아서 글로 남김.


상황은 이러하다.


1. Android 의 AlertDialog 를 실행하면, 사용자가 "닫기" 를 누르지 않아도, 백단( backEnd) 프로그램이 계속 돌아갈까?

2. AlertDialog 를 여러개 띄울 수 있는거임?


코드는 별거없다. 그냥 테스트 수준.


public void Popup( String _msg )

{

        AlertDialog.Builder builder = new AlertDialog.Builder( getBaseContext() );

        builder.setPositiveButton( "확인", new DialogInterface.OnClickListener() {

// @Override

public void onClick(DialogInterface dialog, int which) {

;;

}

});


    builder.setMessage( _msg );

    builder.show();

}


@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

...

int tcount = 0;

Popup( "테스트 count:" + tcount++ );        // AlertDialog 함수化

Log.v( "test", "tcount:" + tcount );

Popup( "테스트 count:" + tcount++ );        // AlertDialog 함수化

Log.v( "test", "tcount:" + tcount );

Popup( "테스트 count:" + tcount++ );        // AlertDialog 함수化

Log.v( "test", "tcount:" + tcount );

Popup( "테스트 count:" + tcount++ );        // AlertDialog 함수化

Log.v( "test", "tcount:" + tcount );

Popup( "테스트 count:" + tcount++ );        // AlertDialog 함수化


...

}



테스트 결과는 , 


1. AlertDialog 결과 화면 중첩 된다.

2. 중간중간 Log도 나온다.




고로,  MFC 나 Javascript 의 MesageBox(), Alert() 과는 다르게, Modal ( 맞나? ) 로 돌아가지 않는다. 

즉, 화면을 점유한 채로 연산을 중지하는 것이 아닌, 

화면은 화면대로 보여주고, 작동은 작동대로 계속 함.




... 코드 바꿔야 겠네. 젠장.





 


반응형