title: Using a custom class with FragmentTabsPager under ActionbarSherlock
body: <p>I'm building an Activity that uses tabs which can also be horizontally swiped.  I'm also using Actionbar Sherlock (ABS) for pre 3.0 compatibility.</p>
  
  <p>I found a good implementation of the FragmentTabsPager with ABS from Stackoverflow user Sparky on <a href="http://code.google.com/p/sherlock-demo/source/browse/#git%2Fsrc%2Fcom%2Fexample%2Fandroid%2Fsherlockdemo" rel="nofollow">http://code.google.com/p/sherlock-demo/source/browse/#git%2Fsrc%2Fcom%2Fexample%2Fandroid%2Fsherlockdemo</a>.</p>
  
  <p>It sets up an adapter as follows:</p>
  
  <pre><code>String[] mAccts;  // source data for the list
  
  // populate mAccts with an array of Strings ...
  
  setListAdapter(new ArrayAdapter&lt;String&gt; (getActivity(),
                  R.layout.simple_list_item_checkable_1,
                  android.R.id.text1, mAccts));
  </code></pre>
  
  <p>This works fine if the list item is a String, but my listview item happens to have two strings plus an image.  So I've tried changing the code to work with my custom class as follows:</p>
  
  <pre><code>ArrayList&lt;MyItem&gt; mItems = new ArrayList&lt;MyItem&gt;();  // new source data
  
  // populate mItems with an array of MyItems ...
  
  setListAdapter(new MyItemAdapter(getActivity(), R.layout.my_list, mItems));
  </code></pre>
  
  <p>Where MyItemAdapter is</p>
  
  <pre><code>public class MyItemAdapter extends ArrayAdapter&lt;MyItem&gt; { ... }
  </code></pre>
  
  <p>MyItemAdapter also includes a getView() function to pull out the right fields from MyItem and inflate the my_list XML.</p>
  
  <p>PROBLEM: It seems like the above changes should work, but the class from which setListAdapter() is called in the example is declared statically, and MyItemAdapter makes a call to getSystemService(), which is not static.  The result is I get an error:</p>
  
  <pre><code>Cannot make a static reference to the non-static method getSystemService(String)
  </code></pre>
  
  <p>I tried making the calling function non-static, but that seems to break the example code.  </p>
  
  <p>Any ideas how to fix this?  I appreciate any and all help!</p>