2012-11-22 4 views
0

시작시 예외 (웹 서비스 호출이 실패한 경우)시 경고 대화 상자를 표시하려고합니다.onStart에 경고 대화 상자를 표시 할 수 없습니다.

내가

코드는 다음입니다 수있는 나는만큼 그것을 단순화

:

protected override void OnStart() 
    { 
     base.OnStart(); 

     // doWSCall(); 
     AlertDialog.Builder builder = new AlertDialog.Builder(this); 
     builder.SetMessage("Test").Create().Show(); 
    } 

대화 상자가 표시되지 않습니다, 아무것도 디버그 출력에 표시되지도 아무것도 장치 로그에 나타나지 않습니다 .

모노입니다.

+0

이 모노 기반인가요? –

+0

@RobertEstivill 예. 고마워. 고마워. – Sam

답변

0
private AlertDialog.Builder alert() 
{ 
     AlertDialog.Builder myQuittingDialogBox =new AlertDialog.Builder(this); 
     myQuittingDialogBox.setTitle("your title"); 
     myQuittingDialogBox.setMessage("set Msg Here"); 


     myQuittingDialogBox.setIcon(R.drawable.yourimg); 

     myQuittingDialogBox.setPositiveButton("yes"), new DialogInterface.OnClickListener() { 

      public void onClick(DialogInterface dialog, int whichButton) 
      { 
       // your code here 
       dialog.dismiss(); 
      } 

     }); 

     myQuittingDialogBox.setNeutralButton("no"), new DialogInterface.OnClickListener() { 
      public void onClick(DialogInterface dialog, int whichButton) { 
      //write your code here 
       dialog.dismiss(); 
     } 
     }); 

     myQuittingDialogBox.create(); 
     return myQuittingDialogBox; 

} 

AlertDialog.Builder diaBox = alert(); 
diaBox.show(); 
를 호출
관련 문제