我想要实现的是让用户长按图库视图中的图像以将他们带到网站。
到目前为止我所拥有的是这个,但似乎无法解决......
.......
public int getCount() {
return imageIDs.length;
.....
public View getView(int position, View convertView, ViewGroup parent){
ImageView imageView;
if (convertView == null){
imageView = new ImageView(context);
imageView.setImageResource(imageIDs[position]);
imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
}else{
imageView = (ImageView) convertView;
}
imageView.setBackgroundResource(itemBackground);
return imageView;
imageView.setOnLongClickListener(imageIDs[position]){
boolean onLongClick(int position,View v) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse ("http://www.google.com"));
startActivity(intent);
return true;
}
{
}
}
}
收到此错误
The method setOnLongClickListener(View.OnLongClickListener) in the type View is not applicable for the arguments
(Integer)
任何帮助将不胜感激!!