1

I am trying to show a customized dialog in my map application after tapping on a map marker . Here is my code for onTap(int index) as per Android developers guide , which is not working . What's wrong here ? Help please !

@Override
    protected boolean onTap(int index) {
        // TODO Auto-generated method stub
          OverlayItem item = mOverlays.get(index);
          Context mContext = getApplicationContext();
          Dialog dialog = new Dialog(mContext);
          dialog.setContentView(R.layout.marker_view);
          dialog.setTitle(item.getTitle());
          TextView textAddress = (TextView) dialog.findViewById(R.id.tv_marker_address);
          TextView textPhone = (TextView)  dialog.findViewById(R.id.tv_marker_phone);
          textAddress.setText(item.getSnippet());
          ImageView image = (ImageView)  dialog.findViewById(R.id.marker_image); 
          dialog.show();
          Button btn = (Button)dialog.findViewById(R.id.btn1);
          btn1.setOnClickListener(this);
          return true;
    }
}
Fahim Ahmed
  • 779
  • 3
  • 12
  • 25

1 Answers1

0

Maybe you need to inflate the layout first ?

user1616685
  • 1,310
  • 1
  • 15
  • 36