2012-11-22 3 views
0

Android 용 MonoDevelop를 사용 중이며 messagebox를 구현하려고합니다.메시지 상자에 오류 표시

현재이 코드는 MapsAndLocationDemo에서 시도하고 있습니다. 주요 '에서 OnCreate'기능에서 호출 할 때

public void createMessageBox (string stringQuestion) 
    { 
     var builder = new AlertDialog.Builder(this); 
     builder.SetTitle ("Test"); 
     builder.SetIcon (Resource.Drawable.Icon); 
     builder.SetMessage (stringQuestion); 

     builder.SetPositiveButton ("Yes", (sender, e) => { 
      Toast.MakeText (this, "You clicked positive button", ToastLength.Short).Show(); 
     }); 

     builder.SetNegativeButton ("No", (sender, e) => { 
      Toast.MakeText (this, "You clicked negative button", ToastLength.Short).Show(); 
     }); 

     builder.SetNeutralButton ("Maybe", (sender, e) => { 
      Toast.MakeText(this, "You clicked neutral button", ToastLength.Short).Show(); 
     }); 

     var dialog = builder.Create(); 
     dialog.Show(); 
    } 

이 코드는 잘 작동 :

여기 내 코드입니다. 그러나 'ItemizedOverlay'라는 기본 '오버레이'에서이 코드를 호출하고 싶습니다.

Cannot access a non-static member of outer type 'MapsAndLocationDemo.MapWithOverlayActivity' via nested type 'MapsAndLocationDemo.MapWithOverlayActivity.MapItemizedOverlay'

가 어떻게이 작동하도록하십시오 수 있습니다

나는 다음과 같은 오류는 무엇입니까? 아니면 메시지 상자를 표시하는 더 좋은 방법이 있습니까?

감사합니다.

+0

잘못된 코드를 게시했습니다. "createMessageBox"라는 함수는 정적이어야합니다. –

답변

1

모든 작업을 완료해야 할 필요가있었습니다.