Android Spinner Adapter Setting to spinner-ThrowExceptions

Exception or error:

I’m using eneter framework to process communication in my android application;
the problem is when I’m trying to populate a spinner, setting the adapter to the spinner cause an undefined exception

Here the code

public void populateSpinner(TypedResponseReceivedEventArgs<String> arg1){
    List<String> list = new ArrayList<String>();
    String listf = arg1.getResponseMessage();
    StringTokenizer tokenizer = new StringTokenizer(listf,",");
    //EditText text = (EditText)findViewById(;
    Spinner forfait = (Spinner)findViewById(;
            ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item,list);
How to solve:

you are passing this in the following piece of code,

 ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,

Not sure in which block this code lies or which class, but ensure that this refers to ActivityName.class or the context


It is most likely because you are using an ArrayAdapter rather than a SpinnerAdapter. ArrayAdapter is an indirect implementer of the SpinnerAdapter interface rather than one which declares that it implements the interface. Check the undefined exception. It is likely telling you that setAdapter(ArrayAdapter) is not defined for Spinner.

Leave a Reply

Your email address will not be published. Required fields are marked *