title: Android dynamic spinner in fragment
body: <p>i need help. I looked in other posts and try to do same but all solutions isn't working. I'm trying to make spinner with dynamic data, but always stop working...</p>
  
  <pre><code>@Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
              Bundle savedInstanceState) {
          View rootView = inflater.inflate(R.layout.fragment_main, container,
                  false);
  
          final List&lt;String&gt; list=new ArrayList&lt;String&gt;();
          list.add("Item 1");
          list.add("Item 2");
          list.add("Item 3");
          list.add("Item 4");
          list.add("Item 5");
  
          Spinner s = (Spinner) rootView.findViewById(R.id.spinner1);
          ArrayAdapter&lt;String&gt; dataAdapter = new ArrayAdapter&lt;String(this.getActivity(), R.array.spinnerItems, list);
          dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
          //ArrayAdapter&lt;?&gt; adapter = ArrayAdapter.createFromResource(getActivity().getBaseContext(), R.array.spinnerItems, android.R.layout.simple_spinner_item);
          s.setAdapter(dataAdapter);
  
          return rootView;
      }
  </code></pre>
  
  <p>Please, how to make it running?</p>