I am creating a list view layout and receive an ArrayAdapter
warning. The error message is below. The warning message is pointing to the following text:
new ArrayAdapter(this, android.R.layout.simple_list_item_1, populateList());
Any assistance will be helpful
warning message:
Description Resource Path Location Type ArrayAdapter is a raw type. References to generic type ArrayAdapter should be parameterized LoginList.java /LoginPlus/src/com/loginplus/home line 95 Java Problem
@Override
protected void onResume() {
super.onResume();
loginListAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, populateList());
loginList.setAdapter(loginListAdapter);
}
Use something like ArrayAdapter<Type>
where "Type" is replaced with the actual type used by the ArrayAdapter.
For example:
ArrayAdapter<CharSequence>
As the warning says, this is because ArrayAdapter is generic, so you should specify the type it refers to so that the compiler can check that everything is good at compile time.
You can read more here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With