tags:

views:

543

answers:

1

Hi,

I am trying to create a list of strings from my arrays.xml file, as found in the android docs too. This is what they use:

ArrayAdapter adapter = ArrayAdapter.createFromResource(context, R.array.colors, android.R.layout.simple_spinner_item);

eclipse is warning that the ArrayAdapter instance is a raw type. Should it really be:

ArrayAdapter<CharSequence> adapter = ...;

?

Thanks

+2  A: 

Hi
It's always better to leave type checking to java compiler, so it would be better to declare your adapter as ArrayAdapter<CharSequence> It probably doesn't change anything in your code, especially when you are sure that you are not going to put anything else but strings to your adapter. But it's definately a good practice to use generics to avoid runtime exceptions.
Regards!

Ramps