Sorry, the error is another one. It is in the ImageButton. But the issue is fixed now. That's why I change it for R.id.none. But when I change it for the right name, I thought it wouldn't run but it runs. Very strange.
imgbutton = (ImageButton) findViewById(R.id.none);
imgbutton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Toast.makeText(Insertarlugar.this, "ImageButton is clicked!",
Toast.LENGTH_SHORT).show();
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.insertarlugar, menu);
return true;
}
}