My app is not compatible with Android 5.
When I run it in any other version it works with no issues.
This is what appears in the logcat when run it in Android 5:
05-16 23:44:10.287 1969-1969/com.barakah.camel E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.barakah.camel, PID: 1969
java.lang.IllegalArgumentException: Spinner adapter view type count must be 1
Here's where the problem lies based on the logcat:
public void regionSpinnerSetup() {
ParseQueryAdapter.QueryFactory<ParseObject> factory = new ParseQueryAdapter.QueryFactory<ParseObject>() {
public ParseQuery create() {
ParseQuery query = new ParseQuery("Region");
return query;
}
};
regionAdapter = new ParseQueryAdapter<ParseObject>(getActivity(),
factory);
regionAdapter.setTextKey("name");
regionSpinner.setAdapter(regionAdapter);
regionSpinner.setSelection(1);
regionSpinner.setOnItemSelectedListener(new RegionSpinnerListener());
}
public void CategorySpinnerSetup() {
ParseQueryAdapter.QueryFactory<ParseObject> factory = new ParseQueryAdapter.QueryFactory<ParseObject>() {
public ParseQuery create() {
ParseQuery query = new ParseQuery("Category");
return query;
}
};
categoryAdapter = new ParseQueryAdapter<ParseObject>(getActivity(),
factory);
categoryAdapter.setTextKey("name");
categorySpinner.setAdapter(categoryAdapter);
categorySpinner.setSelection(1);
categorySpinner
.setOnItemSelectedListener(new CategorySpinnerListener());
}
class RegionSpinnerListener implements Spinner.OnItemSelectedListener {
@Override
public void onItemSelected(AdapterView parent, View v, int position,
long id) {
// TODO Auto-generated method stub
ParseObject theSelectedObject = regionAdapter.getItem(position);
Log.e("ABC", "Name is : " + theSelectedObject.getString("name") + " objectId is : " + theSelectedObject.getObjectId());
regionobject = theSelectedObject;
}
Both regionSpinner and categorySpinner are objects of type Spinner ...
@Override
public void onActivityCreated(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onActivityCreated(savedInstanceState);
regionSpinnerSetup();
CategorySpinnerSetup();
}
Any idea how to solve it?