我試圖通過簡單地單擊完整圖像來完成此活動。然後它應該返回到gridview活動,從它被選擇的地方。 但我只是不能得到它的代碼,日食不斷告訴我 [方法setOnItemClickListener(新的AdapterView.OnItemClickListener(){})未定義的類型ImageView]在setOnItemClickListener。setOnItemClickListener在eclipse中給出了錯誤
這裏全屏圖像的活動:
package com.sjapp.picsnd4;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.AdapterView.OnItemClickListener;
import android.view.View;
public class FullImageActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.full_image);
// get intent data
Intent i = getIntent();
// Selected image id
int position = i.getExtras().getInt("id");
ImageAdapter imageAdapter = new ImageAdapter(this);
ImageView imageView = (ImageView) findViewById(R.id.full_image_view);
imageView.setImageResource(imageAdapter.mThumbIds[position]);
ImageView fsImage = (ImageView) findViewById(R.id.fullimage_id);
fsImage.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView parent, View v,
int position, long id) {
finish();
}
});
}
}
任何想法?