title: vertical list view with horizontal scroll view android
body: <p>I am trying to implement a list view with horizontal scroll view. I am getting a logcat error "null pointer exception " while setting list view adapter. My list view should be displayed inside sherlock fragment </p>
  
  <pre><code>public class Trending extends SherlockFragment
  
  {
  List&lt;String&gt; list;
      ListView prog_list;
  
  
  // Array of integers points to images stored in /res/drawable-ldpi/
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
             Bundle savedInstanceState) 
  {
            View myFragmentView = inflater.inflate(R.layout.trendslay, container,false);       
            prog_list = (ListView)myFragmentView.findViewById(R.id.lv1);
            return prog_list;
           }
  
  
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState)
  {
      super.onCreate(savedInstanceState);
  
      list = new ArrayList&lt;String&gt;();
      list.add("hi");
      list.add("hello");
      list.add("how r u");
      list.add("hi");
      list.add("hello");
      list.add("how r u");
      list.add("hi");
      list.add("hello");
      list.add("how r u");
  
      ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(getActivity(),
                android.R.layout.simple_list_item_1, android.R.id.text1,list);
      prog_list.setAdapter(adapter);
  
  
      }
  </code></pre>