I have done this same logic in iOS. But android the logic is not working. In iOS, i have superview called annotation if (!annotaion.superView) then i'm adding the overlay image after closing button i'm closing the imageview then after 5sec i'm enabling annotation view without adding to superview because of this logic if (!annotaion.superView). But i have tried in android, it's not working. But second time scanning the image the teapot is showing but the overlay image is not showing
if (text.equalsIgnoreCase("stones")) {
LayoutInflater inflater = LayoutInflater.from(ImageTargets.this);
overlay_layout = (RelativeLayout) inflater.inflate(R.layout.overlay,
null, false);
addContentView(overlay_layout, new LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.MATCH_PARENT));
mcloseButton = (Button)overlay_layout. findViewById(R.id.closebtn);
image = (ImageView)overlay_layout.findViewById(R.id.imageView1);
overlay_layout.setVisibility(View.GONE);
mcloseButton.setVisibility(View.GONE);
image.setVisibility(View.GONE);
if (overlay_layout.getVisibility() == View.GONE) {
overlay_layout.setVisibility(View.VISIBLE);
mcloseButton.setVisibility(View.VISIBLE);
image.setVisibility(View.VISIBLE);
}
mcloseButton.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
mcloseButton.setVisibility(View.GONE);
image.setVisibility(View.GONE);
overlay_layout.setVisibility(View.GONE);
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
LayoutInflater inflater = LayoutInflater.from(ImageTargets.this);
overlay_layout = (RelativeLayout) inflater.inflate(R.layout.overlay,
null, false);
addContentView(overlay_layout, new LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.MATCH_PARENT));
overlay_layout.setVisibility(View.GONE);
mcloseButton.setVisibility(View.GONE);
image.setVisibility(View.GONE);
}
}, 1000);
}
});