Replace a view with other view By code
<p><br>
I want to replace a view with other other by code<br>
For example i need to change a <code>imageview</code> to <code>progressBar</code> by code. </p>

<pre><code>public void changeToProgressBar(ImageView imageview,Context context){
            ProgressBar one = new ProgressBar(context);
            one.setLayoutParams(imageview.getLayoutParams());
            imageview.setVisibility(View.GONE);
            one.setVisibility(View.VISIBLE);

            //NOW I NEED TO PLACE 'one' EXACTLY THE PLACE WHERE  'imageview' WAS THERE 
        }
</code></pre>

<p>I need to use this many place. I know to set by sending the parent <code>viewgroup</code>.<br>
Is there anyway to get the parent <code>viewgroup</code> from <code>imageview</code><br>
Thanks   </p>
