when you want to show listView and hide ImageView, you can follow below code.
listView.setVisibility(View.VISIBLE); // showing listview
imageView.setVisibility(View.GONE); // hiding imageview
you can choose which one to show
and which one to hide
.
solved Add or Remove ImageView dynamically