title: Launch a Dialog Fragment on button click from a custom base adapter>getView [IMG INCLUDED]
body: <p>Alright so i have a list(which is also a fragment dialog) that displays a users friends and each item in that list has a button(labeled friends in the picture) and when users click that button id like to display another fragment dialog that displays all the options for interacting with that user(friend request, block, send private message ect...) the problem is that this button and its onClick listener are currently implemented via overriding my listview adapters getView method and to create a fragmentDialog requires access to fragment manager. is there a way to make this work?</p>
  
  <p>EDIT: I cannot post actual code from the project , but ive attached a simplified base adapter w. onClickListener that should make it clear what im trying to do . I cannot access the fragmentManager from a base adapter class to make the dialog fragment possible</p>
  
  <pre><code>LazyAdapter.java
  package com.example.androidhive;
  
  import java.util.ArrayList;
  import java.util.HashMap;
  
  import android.app.Activity;
  import android.content.Context;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.BaseAdapter;
  import android.widget.ImageView;
  import android.widget.TextView;
  
  public class LazyAdapter extends BaseAdapter {
  
      private Activity activity;
      private ArrayList&amp;lt;HashMap&amp;lt;String, String&amp;gt;&amp;gt; data;
      private static LayoutInflater inflater=null;
      public ImageLoader imageLoader;
  
      public LazyAdapter(Activity a, ArrayList&amp;lt;HashMap&amp;lt;String, String&amp;gt;&amp;gt; d) {
          activity = a;
          data=d;
          inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          imageLoader=new ImageLoader(activity.getApplicationContext());
      }
  
      public int getCount() {
          return data.size();
      }
  
      public Object getItem(int position) {
          return position;
      }
  
      public long getItemId(int position) {
          return position;
      }
  
      public View getView(int position, View convertView, ViewGroup parent) {
          View vi=convertView;
          if(convertView==null)
              vi = inflater.inflate(R.layout.list_row, null);
           Button requestBtn = (Button)vi.findViewById(R.id.title); // title
  
          HashMap&amp;lt;String, String&amp;gt; song = new HashMap&amp;lt;String, String&amp;gt;();
          song = data.get(position);
  
          // Setting all values in listview
          title.setText(song.get(CustomizedListView.KEY_TITLE));
          artist.setText(song.get(CustomizedListView.KEY_ARTIST));
          duration.setText(song.get(CustomizedListView.KEY_DURATION));
          imageLoader.DisplayImage(song.get(CustomizedListView.KEY_THUMB_URL), thumb_image);
  
          requestBtn.setOnClickListener(new myOnClickListener(position));
          return vi;
      }
  
          public class myOnClickListener implements OnClickListener{
       private int position;
    private String clicked_uid;
    public myOnClickListener(int position){
        this.position=position;
       }
    @Override
    public void onClick(View v) {
  
  
      //THIS IS WHERE IM TRYING TO PUT THE FRAGMENT DIALOG
  
          FragmentManager fm = TabHostFragmentActivity.this.getSupportFragmentManager();
          FriendsFamiliarsDialog friendsDialog = new FriendsFamiliarsDialog().newInstance(TabHostFragmentActivity.profile_uid,"friends");
          friendsDialog.show(fm, "friendsdialog");
  
  
  
  
  
    }
  
      }
  }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/WZtNA.png" alt="listview fragment dialog getView android"></p>