title: Android - Cannot resolve symbol for getSupportFragmentManager
body: <p>Here's the code for my ItemAdapter which I use as an adapter for list in this way. </p>
  
  <pre><code>list.setAdapter(new ItemAdapter(thisContext,imageUrl));
  </code></pre>
  
  <p>I'm trying to implement an onclick listener for the button that will add an item to a ListFragment. When I compile, it says "cannot resolve symbol getSupportFragmentManager". See bold below. But I'm pretty sure I imported android.support.v4.app.FragmentActivity (see below).
  I used the same getSupportFragmentManager in my main activity and it works. I don't understand why it isn't here. And if it isn't, how should I obtain the HeadlinesFragment so that I can add to the list in that fragment? </p>
  
  <p>Appreciate any help I can get here. </p>
  
  <p>Pier. </p>
  
  <pre><code>package com.suite.android.menu;
  
  import android.content.Context;
  import android.graphics.Bitmap;
  import android.graphics.BitmapFactory;
  import android.util.Log;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.BaseAdapter;
  import android.widget.Button;
  import android.widget.ImageView;
  import android.widget.TextView;
  **import android.support.v4.app.FragmentActivity;**
  
  
  public class ItemAdapter extends BaseAdapter {
  
  private Context itemPageContext;
  private String imagesUrl[];
  private static final String TAG = "ItemAdapter" ;
  
  public ItemAdapter(Context c, String[] imageUrl)
  {
     super();
     itemPageContext = c;
     imagesUrl = imageUrl.clone();  // copy over
  
  
  }
  
  private LayoutInflater getLayoutInflater()
  {
      return (LayoutInflater) itemPageContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  }
  
  public View getView(final int position, View convertView, ViewGroup parent)
  {
      // all this is for 1 item in the list
  
      View theView = convertView;
      final ViewHolder holder;
      if (convertView == null) {
          theView = getLayoutInflater().inflate(R.layout.item_list_image, null);
          holder = new ViewHolder();
          holder.text = (TextView) theView.findViewById(R.id.foodTitle);
          holder.image = (ImageView) theView.findViewById(R.id.foodImage);
          holder.button = (Button) theView.findViewById(R.id.addOrderButton);
          theView.setTag(holder);
      } else
          holder = (ViewHolder) theView.getTag();
  
      holder.text.setText("Item " + position);
      holder.image.setImageResource(R.drawable.ic_launcher);
  
      holder.button.setOnClickListener(new View.OnClickListener() {
          public void onClick(View view) {
              **HeadlinesFragment headFragment = (HeadlinesFragment) getSupportFragmentManager().findFragmentById(R.id.headlines_fragment);**
              headFragment.AddItem("One");
              Log.d(TAG, "Added Item!");
          }
      });
  
      return theView;
  }
  
  private class ViewHolder {
      public TextView text;
      public ImageView image;
      public Button button;
  }
  
  @Override
  public int getCount() {
      return imagesUrl.length;
  }
  
  @Override
  public Object getItem(int position) {
      return position;
  }
  
  @Override
  public long getItemId(int position) {
      return position;
  }
  
  }
  </code></pre>