Compound component design problem in Android
<p>I am trying to create a compound component in android. This compound component have 2 inner components. one of them is a custom component (assume CompX ) with some public methods. 
 And the second component is the plain button
So the compound component looks like the below,</p>

<p>class CompoundComp extends LinearLayout{</p>

<pre><code>    private CompX customComp;
    private Button comp2;

    public void method1(){
          ------------------------------
          ------------------------------
    }

        -----------------------
        -----------------------
</code></pre>

<p>} </p>

<p>class CompX{</p>

<pre><code>public void methodA(){
             ----------------------
}

public void methodB(){
             ----------------------
}
</code></pre>

<p>}</p>

<p>Now I am using the Compound Component from a client program as,</p>

<p>class Client{</p>

<pre><code> CompoundComp compoundObj = new CompoundComp();
  compoundobj.method1();                
</code></pre>

<p>}</p>

<p>Now my problem is to access the CompX methods. My known solutions for this are as,</p>

<ol>
<li>In CompoundComp class create public methods that in turn calls the CompX public methods</li>
<li><p>Make CompX instance as public in CompoundComp class so that the client can call them directly</p>

<p>Frankly I am not able decide which way to go as I am unable to conclude on the pros 'n' cons of both the solutions. </p>

<p>Someone please suggest me if my solutions are proper one or not. If so which one is the better one to use, if not so please give me some suggestions or clues of solutions.</p></li>
</ol>

<p>Thanks</p>
