title: Spinners android getting sendUserActionEvent() mView == null in a fragment
body: <p>I am new to android,though i googled i couldn't resolve this below problem..
  so please help out!</p>
  
  <p>I am getting <code>sendUserActionEvent() mView == null</code> error when i click on my spinner.</p>
  
  <p>below is my new_customer.xml spinner and its adapter in Fragment.</p>
  
  <pre><code>   &lt;ScrollView
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"&gt;
  &lt;GridLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:paddingLeft="@dimen/activity_horizontal_margin"
      android:paddingRight="@dimen/activity_horizontal_margin"
      android:paddingTop="@dimen/activity_vertical_margin"
      android:paddingBottom="@dimen/activity_vertical_margin"
      android:columnCount="1"
      android:rowCount="9"
      tools:context="com.sensei.mencore.NewCustomerFragment"&gt;
      &lt;EditText
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:id="@+id/customer_id"
          android:hint="Customer ID"
          style="@style/style_edit_text_default"
  
          /&gt;
      &lt;EditText
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:id="@+id/first_name"
          android:hint="First Name"
          style="@style/style_edit_text_default"
          /&gt;
  
      &lt;EditText
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:id="@+id/middle_name"
          android:hint="Middle Name"
          style="@style/style_edit_text_default"
          /&gt;
  
      &lt;EditText
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:id="@+id/second_name"
          android:hint="Last Name"
          style="@style/style_edit_text_default"
          /&gt;
  
  
       &lt;RelativeLayout
  
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"&gt;
          &lt;EditText
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:hint="Date of Birth"
              style="@style/style_edit_text_default"
              android:inputType="date"
              android:id="@+id/customer_date_picker"/&gt;
  
          &lt;ImageView
              android:id="@+id/CalenderView"
              android:padding="5dp"
              android:layout_width="35dp"
              android:layout_height="dp"
              android:layout_alignTop="@+id/customer_date_picker"
              android:layout_alignBottom="@+id/customer_date_picker"
              android:layout_alignRight="@+id/customer_date_picker"
              android:onClick="ShowDateDlg"
              android:src="@drawable/calendar"
              /&gt;
      &lt;/RelativeLayout&gt;
      &lt;EditText
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
  
          android:maxLines="10"
          style="@style/style_edit_text_default"
          android:hint="Addressline 1"
          android:scrollbars="vertical"  /&gt;
      &lt;EditText
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
  
          android:maxLines="10"
          style="@style/style_edit_text_default"
          android:hint="Addressline 2"
          android:scrollbars="vertical"  /&gt;
  
      &lt;EditText
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
  
          android:maxLines="10"
          style="@style/style_edit_text_default"
          android:hint="Addressline 3"
          android:scrollbars="vertical"  /&gt;
  
  
      &lt;Spinner
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
            android:id="@+id/country_code"
          android:hint="Country code"
          style="@style/style_edit_text_default"
          /&gt;
  
      &lt;EditText
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:id="@+id/state_code"
          android:hint="State code"
          style="@style/style_edit_text_default"
          /&gt;
  
      &lt;EditText
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:id="@+id/city_code"
          android:hint="City code"
          style="@style/style_edit_text_default"
          /&gt;
      &lt;EditText
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:id="@+id/district_code"
          android:hint="District code"
          style="@style/style_edit_text_default"
          /&gt;
      &lt;EditText
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:id="@+id/branch_code"
          android:hint="Branch code"
          style="@style/style_edit_text_default"
          /&gt;
      &lt;EditText
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:id="@+id/pin_code"
          android:hint="Pin code"
          android:inputType="number"
          style="@style/style_edit_text_default"
          /&gt;
  
  
      &lt;Button
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          style="@style/style_btn_default"
          android:text="Create"
          android:id="@+id/create_button"
          /&gt;
  
  
  
  &lt;/GridLayout&gt;
  </code></pre>
  
  <p></p>
  
  <p>Fragment and strings.xml are here ---</p>
  
  <pre><code> public class NewCustomerFragment extends Fragment {
      EditText customerDobEditText;
      SimpleDateFormat sdf;
      Spinner sp;
      Calendar calendar = Calendar.getInstance();
     DatePickerDialog.OnDateSetListener d = new DatePickerDialog.OnDateSetListener() {
      @Override
  
      public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) {
  
          calendar.set(Calendar.YEAR,year);
  
          calendar.set(Calendar.MONTH,monthOfYear);
  
          calendar.set(Calendar.DAY_OF_MONTH,dayOfMonth);
  
          updateDate();
      }
  };
  public void updateDate(){
      String myFormat="yyyy/MM/dd";
      sdf = new SimpleDateFormat(myFormat, Locale.US);
      customerDobEditText.setText(sdf.format(calendar.getTime()));
  
  public static NewCustomerFragment newInstance() {
      NewCustomerFragment fragment = new NewCustomerFragment();
      return fragment;
  }
  
  public NewCustomerFragment() {  }
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  }
  
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
      View v = inflater.inflate(R.layout.fragment_new_customer, container, false);
  
      sp = (Spinner) v.findViewById(R.id.country_code);
      sp.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
  
          public void onItemSelected(AdapterView&lt;?&gt; arg0, View arg1,
                                     int arg2, long arg3) {
  
              Toast.makeText(getActivity(), sp.getSelectedItem().toString(),
                      Toast.LENGTH_SHORT).show();
          }
  
          public void onNothingSelected(AdapterView&lt;?&gt; arg0) {
              // TODO Auto-generated method stub
  
          }
  
      });
      return v;
  }
  
  
  
  
  
   &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;resources&gt;
   &lt;string-array name="country_code"&gt;
      &lt;item&gt;Item 1&lt;/item&gt;
      &lt;item&gt;Item 2&lt;/item&gt;
      &lt;item&gt;Item 3&lt;/item&gt;
      &lt;item&gt;Item 4&lt;/item&gt;
      &lt;item&gt;Item 5&lt;/item&gt;
  &lt;/string-array&gt;
  </code></pre>
  
  <p></p>