Currently, your implementation is OnClickListenernot limited to any kind, so it will not be launched.
You must create your own (maybe internal, but not anonymous) class that implements the interface OnClickListener:
public class RandomClickListener implements View.OnClickListener
{
private final int randomIndex;
public RandomClickListener(final int randomIndex)
{
this.randomIndex = randomIndex;
}
@Override
public void onClick(View v)
{
Intent top = new Intent(Main.this, ProjectDetail.class);
top.putExtra("spendino.de.ProjectDetail.position", randomIndex);
startActivity(top);
}
}
[...]
image1.setOnClickListener(new RandomClickListener(randomIndex));
, image1, ProjectDetail randomIndex, .
ProjectDetails ( - , ), OnClickListener .