public String[] mArrayList = {" title", "sex", "name", "sex","fff","eee","iii"};
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
this,**mArrayList**,R.layout.sq,
android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
I want to add value to the spinner using mArrayList array.but ERROR display as below.
The method createFromResource(Context, int, int) in the type
ArrayAdapter is not applicable for the arguments (sq, String[], int,
int).
What am I doing wrong?
How can I access static array from another java class?
If you have any worked through examples, that would be a real help!
ArrayAdapter.createFromResource()has the arguments ofcontextThe application’s environment.textArrayResIdThe identifier of the array to use as the datasource.
textViewResIdThe identifier of the layout used to create views.Then how can we pass more parameters.
I think you want to create ArrayAdapter using this constructor
ArrayAdapter(Context, int, int, T[])and make sure your parameters sequence is also correct as the constructor.