为什么我在set adapter上获得null引用异常?

时间:2014-07-11 20:32:16

标签: android spinner

      s1 = (Spinner) findViewById(R.id.ProductTypeSpinner);
      ArrayAdapter<CharSequence> adapter= ArrayAdapter.createFromResource(this, R.array.Product_Types, android.R.layout.simple_spinner_item);
      adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        s1.setAdapter(adapter);           

当我设置s1.setAdapter(适配器);它会遇到nullPointerException

0 个答案:

没有答案