how to add sub view to view in android some thing like iphone programing
<p>i want to a add sub view to view in android . When ever i clicked on each view it should come front .For that i created  custom relative layout class WindowView  with a custonImageView view as a member </p>

<pre><code>                public class WindowView extends RelativeLayout {

             CustomImageView imageview;

             int windowid; 

public WindowView(Context context,Bitmap image,int xpos , int ypos , int width , int height , int id) {
    super(context);
    LayoutParams layout = new RelativeLayout.LayoutParams(xpos + width, ypos + height);
     layout.leftMargin   = xpos;
     layout.topMargin = ypos;
     setLayoutParams(layout);
     windowid = id;
     imageview = new CustomImageView(context,id);
     imageview.setImageBitmap(image);
     addView(imageview);
     this.setOnTouchListener(new OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {

            getfocus();
            //recall = true;
            return true;
        }
    });
    // TODO Auto-generated constructor stub
}
</code></pre>

<p>and added function to it named addWindowView which will add sub view to view .some thing like this</p>

<pre><code>                 public void addWindowView(WindowView View)
                    {
                       this.addview(view);
                    }
</code></pre>

<p>Now i wrote a function named getfocused() which will take care for image to come front</p>

<pre><code>                public void getfocused()
                    {
                     this.bringToFront();
                     imageview.getfocused();
                    }
</code></pre>

<p>in custom image class getfocused is implemented like this</p>

<pre><code>                 public void getfocused()
                   {
                     this.bringtofront();
                   }
</code></pre>

<p>i created and added window views like this in activity class </p>

<pre><code>    microsoftword = new WindowView(this,bm,50,50,bm.getHeight()+90,bm.getWidth()+90,0);
    notepad       = new WindowView(this,bm2, 50, 50, bm2.getHeight(),bm2.getWidth(),1);
    firefox       = new WindowView(this,bm3, 10, 10, bm3.getWidth(), bm3.getHeight(),2);


   microsoftword.addWindowView(firefox);
   notepad.addWindowView(microsoftword);
   setContentView(notepad);
</code></pre>

<p>now the problem is when i clicked on firefox image when notepad image is front . the firefox
image is not coming front .. but when clicked on microsoftword image , that particular image of microsoft is coming front and again if we press on the firefox image , it is coming
front ... plz help me so that when ever i click on the each individual image that should come front..</p>

<p>Sorry for any wrong i have done while posting this question.
Thanks in advance.</p>
