alertdialog 에   textview 를 넣기 위해서

따로 layout을 하나 만들었습니다.

 

이걸 이제 alertdialog 를 show 하기 전에  setView()   메소드를 이용해 뷰를 넣으려고 하는데,  문제점이 생겼는데 꽤 오래 해결을 못하고 있습니다.

 

우선

 

구글맵 지도상에서 (mapview) 에 overlay 로 표기된  이미지를 클릭 하면 alertdialog 가 뜨는  로직입니다.

 

때문에 overlay  class가 따로 있고, 이 클래스 내에  onTab  메소드안에서

alertdialog  발생을 시키도록 합니다.

 

 

 

 protected boolean onTap(int index) {
  OverlayItem item = mOverlays.get(index);
  AlertDialog.Builder dialog = new AlertDialog.Builder(mContext);
  dialog.setTitle(item.getTitle());
  LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  
  TextView tv = (TextView) findViewById( R.id.alerttext );
  tv.setText( item.getSnippet());
  View layout = inflater.inflate(R.layout.alert_dialog, findViewById(R.id.layout_root));
  dialog.setView(( layout ) );
  
  dialog.show();
  return true;
 }

 

라고 했으나 ....  Activity 관련해서 ... findViewById 가 제대로 동작하지 않는것 같은데 ....

어찌해야 할까요 ㅠ ㅠ?