I want to call a new activity via click on the picture on the lazy adapter, but why in the following line appears Intent error "The constructor Intent(LazyAdapter, Class) is undefined"
// Click on Image
gambar.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
String strImageID = data.get(position).get("ImageID").toString();
String strImageName = data.get(position).get("ImageName").toString();
String strImagePathFull = data.get(position).get("ImagePathFull").toString();
Intent newActivity = new Intent(LazyAdapter.this,VoteActivity.class); //Line error
newActivity.putExtra("ImageID", strImageID);
newActivity.putExtra("ImageName", strImageName);
newActivity.putExtra("ImagePathFull", strImagePathFull);
startActivity(newActivity); //line error
}
});
What steps am I doing wrong to call new activity in lazyadapter. I plan images on LazyList can be clicked, then appear a new activity with the bigger picture. Please help, am I wrong to call a new activity. What should I do so that the image can be clicked LazyList then performed with a full-size image and then do the voting.
It should be context of your Activity not the Adapter class,
Intent newActivity = new Intent(YourActivity.this,VoteActivity.class);instead of
Intent newActivity = new Intent(LazyAdapter.this,VoteActivity.class);