Is the ArrayAdapter a raw warning?

I create a list view layout and get an ArrayAdapter warning. The error message is below. A warning message indicates the following text:

 new ArrayAdapter(this, android.R.layout.simple_list_item_1, populateList()); 

Any help would be helpful

warning message:

Description Resource Path Location Type ArrayAdapter is a raw type. References to the generic ArrayAdapter type must be parameterized LoginList.java/LoginPlus/src/com/loginplus/home line 95 Problem with Java

 @Override protected void onResume() { super.onResume(); loginListAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, populateList()); loginList.setAdapter(loginListAdapter); } 
+4
source share
1 answer

Use something like ArrayAdapter<Type> , where the "Type" is replaced by the actual type used by the ArrayAdapter.

For instance:

ArrayAdapter<CharSequence>

As the warning says, this is because the ArrayAdapter is generic, so you must specify the type it refers to so that the compiler can verify that everything is fine at compile time.

You can read it here .

+12
source

Source: https://habr.com/ru/post/1395989/


All Articles