title: How to set ArrayAdapter for spinner in Fragment
body: <p>I am trying to add items to spinner in fragment. But i am having problem with the context. Because in fragment there is no context. Here how i am doing</p>
  
  <pre><code>public class DetailFrag extends Fragment {
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  
          View scrollView = inflater.inflate(R.layout.myscrollview , container, false);       
          LinearLayout linearLayout = (LinearLayout) scrollView.findViewById(R.id.mylayout1);
  
          for (int i=0; i&lt;questionList.size(); i++) {
  
              View verticalLinearLayout = inflater.inflate(R.layout.mylistrow,  null);
              View horizontalLInearLaoyout = verticalLinearLayout.findViewById(R.id.questionRow);
              TextView tv = (TextView) horizontalLInearLaoyout.findViewById(R.id.question);
              Spinner spinner = (Spinner) horizontalLInearLaoyout.findViewById(R.id.spinner);
  
              //Problem: how to define this in fragment createFromResource(this,...)
              ArrayAdapter&lt;CharSequence&gt; adapter = ArrayAdapter.createFromResource(
                      this, R.array.options_array, android.R.layout.simple_spinner_item);
  
              EditText editText = (EditText) verticalLinearLayout.findViewById(R.id.txtMultiLine);
  
              String question = questionList.get(i).question;
  
              tv.setId(i);
              tv.setText(i + question);
              spinner.setId(i);
              editText.setId(i);
  
              linearLayout.addView(verticalLinearLayout);          
          }       
          return scrollView;  
      } //end of onCreateView()
  } //end of class DetailFrag
  </code></pre>