title: How to show a dialog fragment from within custom adapter?
body: <p>I want to show a dialog whenever someone clicks an image from one of the rows in a customized listview.  How should I go about doing this?  Here's what I've implemented so far in my custom adapter.  See the "<em>How to show dialog fragment ???</em>" comment in the code for where I'm stumped.</p>
  
  <pre><code>public class DirectoryAdapter extends BaseAdapter {
  
  private Context mContext;
  private final Session mSession;
  private final ArrayList&lt;MyObject&gt; mMyObjects;
  
  public DirectoryAdapter(Context context, Session session, ArrayList&lt;MyObject&gt; myObjects) {
      mContext = context;
      mSession = session;
      mMyObjects= myObjects;
  }
  
      public View getView(int position, View convertView, ViewGroup parent) {
  
      LayoutInflater inflater = (LayoutInflater) mContext
          .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  
      View view = null;
  
      try {
          if (convertView == null) {
  
              view = new View(mContext);   
              // get row item from directory_item.xml
              view = inflater.inflate(R.layout.server_row, null);
              view.setLongClickable(true);
          } else {
              view = (View) convertView;              
          }
  
          //Info button
          ImageView info = (ImageView) view.findViewById(R.id.iv_directory_item_options);
  
          info.setOnClickListener(new OnClickListener() {
              @Override
              public void onClick(View view) {
                          ServerMenuDialog dialog = new ServerMenuDialog();
                  dialog.setRetainInstance(true);
  // How to show dialog fragment ???
                          dialog.show(view.getContext(), "Server Menu");  //EXAMPLE -- WONT COMPILE  there is no such view.getContext() method
              }
  
          });
  
      } catch (Exception ex) {
          //TODO error handling
      } finally {
          return view;
      }
  
  
  }
  </code></pre>