Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unchecked call to super of ArrayAdapter

Tags:

android

I have implemented a custom Array Adapter and though the app works fine, but I get this error when on super line:

Unchecked call to ArrayAdapter(Context, int, T[]) as a member of raw type Android.Widget.ArrayAdapter

This is my custom ArrayAdapter:

class MyArrayAdapter extends ArrayAdapter {

    public MyArrayAdapter(Context context, int textViewResourceId, Object[] objects)
    {
        super(context, textViewResourceId, objects);
    }
    .
    .
    .

super is highlighted as error.

How can I fix this?

like image 480
Ali Avatar asked Apr 23 '13 19:04

Ali


2 Answers

Change your class declaration to:

class MyArrayAdapter extends ArrayAdapter<Object>

By the way consider using something more specific than Object - it will be more convenient for you too.

like image 136
Boris Strandjev Avatar answered Oct 14 '22 08:10

Boris Strandjev


If you take a look at the ArrayAdapter class, it's a generic class. So you have to specify which type of datas will be manipulate through your adapter. For example, if you manipulate Strings :

class MyArrayAdapter extends ArrayAdapter<String> {
//
}
like image 35
Alexis C. Avatar answered Oct 14 '22 08:10

Alexis C.