简体   繁体   中英

AdapterView is a raw type. References to generic type AdapterView<T> should be parameterized

my code showing this error...AdapterView is a raw type. References to generic type AdapterView should be parameterized for the AdapterView, what should i do?

public void onItemClick(AdapterView adapterview, View view, int i, long l) //*AdapterView is a raw type. References to generic type AdapterView<T> should be parameterized 
{
    ((ImageView)b.findViewById(0x7f090000)).setImageResource(a.getResources().obtainTypedArray(0x7f050000).getResourceId(i, -1));
    ((Button)b.findViewById(0x7f090002)).setOnClickListener(new c(this, b));
    ((Button)b.findViewById(0x7f090003)).setOnClickListener(new d(this, i));
    String s = a.getIntent().getAction();
    if ("android.intent.action.GET_CONTENT".equals(s) || "android.intent.action.PICK".equals(s))
    {
        ((Button)b.findViewById(0x7f090004)).setOnClickListener(new e(this, i, b));
    }
    b.show();
}

This is because this AdapterView is probably parametrized, which means that in its implementation the type is not forced, for example, to String or whatever else, but it's defined by the user.

So basically what the warning (not error) is telling you that instead of AdapterView adapterview you have to set it to AdapterView<YourType> adapterview (so you'd need to put here the type you've defined the AdapterView in the declaration.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM