Below is my code. But it shows it is not possible. Can someone please suggest me how to set the arraylist to the spinner rather than setting simple array to the spinner.Below is my code.
ArrayList<String> categoryList = new ArrayList<String>();
//Here I have code to set string values to arraylist
//Below is the code where I am attempting to set the arraylist but it says “The constructor ArrayAdapter(new Runnable(){}, int, ArrayList) is undefined“
Spinner spinnerCategory = (Spinner)findViewById(R.id.spinnercategory);
ArrayAdapter<String> categoriesAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, categoryList);
Please use Context of activity as the first parameter of the ArrayAdapter, you can use
ActivityName.thisinstead ofthis, where the ActivityName is the name of the activity class. It seems you are running this code, in some Runnable, or Thread class, so right now,thisis the instance of aRunnableobject.