![](/img/trans.png)
[英]Type Class is a raw type. References to generic type Class<T> should be parameterized
[英]AdapterView is a raw type. References to generic type AdapterView<T> should be parameterized
我的代码显示此错误... AdapterView是原始类型。 应该为AdapterView设置对泛型类型AdapterView的引用,我该怎么办?
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();
}
这是因为此AdapterView
可能已参数化,这意味着在其实现中不会强制将类型强制为String
或其他类型,而是由用户定义。
所以基本上,警告(不是错误)告诉您,必须将其设置为AdapterView<YourType> adapterview
(而不是AdapterView adapterview
AdapterView<YourType> adapterview
(因此,您需要在声明中放入定义AdapterView
的类型。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.