title: Android communication between fragment and baseadapter
body: <p>Need expert opinion how should i structure this issue. I have a custom method <strong>process_filter</strong> that resides in a fragment as it needs to access a private <code>TextView</code> and <code>List</code> of this fragment.</p>
  
  <p>In the middle of processing, this fragment will access a <code>BaseAdapter</code> and inside this <code>BaseAdapter</code> I need to use back <strong>process_filter</strong> method</p>
  
  <p>Basically here is the structure:</p>
  
  <p><strong>MyFragment.java</strong></p>
  
  <pre><code>public class MyFragment extends Fragment {
  
     private List&lt;String&gt; filter_list;
     private TextView no_of_filter;
  
     @Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  
     View view = inflater.inflate(R.layout.my_fragment_layout, container, false);
     no_of_filter = (TextView) view.findViewById(R.id.no_of_filter_tv);
     .
     MyAdapter custom_adapter = new MyAdapter(context, "string 1", "string 2");
     .
     process_filter("string 1", "string 2");
     .
     }
  
     public void process_filter(String in_preference, String current_value)
     {
         no_of_filter.setText(in_preference);
     }
  </code></pre>
  
  <p><strong>MyAdapter.java</strong></p>
  
  <pre><code>   class MyAdapter extends BaseAdapter {
  
         public View getView( final int position, View convertView, ViewGroup   parent)
         {
               holder.checkBox.setOnClickListener( new View.OnClickListener() {
                  public void onClick(View v) {
                      //Here I need to access back process_filter from fragment 
                      process_filter ("string 1, string 2");
                  }
               }
         }
     }
  </code></pre>