title: expanding listview custom component with button click
body: <p>i'm developing a small application in with a list view filled with a compound component. This component has two text view and one button inside. One of the text view is invisible and when the button is clicked it should appear. I can show the list but i can't make the textview visible when the button is clicked.
  Here is the xml of the component:</p>
  
  <pre><code>&lt;RelativeLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
     android:layout_height="wrap_content"&gt;
   &lt;TextView 
    android:text="@+id/TextView01" 
    android:id="@+id/placeNamwView" 
    android:layout_height="wrap_content" 
    android:textSize="30dp" 
    android:layout_width="wrap_content" 
    android:maxWidth="250dp"&gt;
    &lt;/TextView&gt;
   &lt;Button 
    android:layout_height="wrap_content" 
    android:layout_toRightOf="@+id/placeNamwView" 
    android:layout_width="wrap_content" 
    android:id="@+id/Button01" 
    android:text="More"&gt;
    &lt;/Button&gt;
   &lt;EditText 
    android:layout_below="@+id/placeNamwView" 
    android:layout_height="wrap_content" 
    android:layout_width="wrap_content" 
    android:text="@+id/TextView01" 
    android:id="@+id/placeAddressView" 
    android:textSize="20dp" 
    android:textColor="#FFFF0000" 
    android:maxWidth="250dp"&gt;
    &lt;/EditText&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>And this is the ArrayAdapter that fills the list:</p>
  
  <pre><code>   public class AddressAdapter extends ArrayAdapter&lt;Item&gt; {
  
     int resource;
     RelativeLayout placeView;
     EditText addressText;
  
  
  
     public AddressAdapter(Context _context, int _resource, List&lt;Item&gt; _items) {
         super(_context, _resource, _items);
         resource = _resource;
     }
  
  
  
     private OnClickListener buttonClick = new OnClickListener() {
       public void onClick (View v) {
         int i = placeView.findViewById(R.id.stub_import).getVisibility();
         visibility(i);
       }
     }
  
  
     private void visibility(int i) {
      //
  
     TODO Auto-generated method stub
       switch(i) {
         case(View.GONE): 
           addressText.setVisibility(View.VISIBLE);
           break;
         case(View.VISIBLE): 
           addressText.setVisibility(View.GONE);
           break;
     }
  
  
  
     @Override
     public View getView(int position, View convertView, ViewGroup parent) {
       Item item = getItem(position);
  
       String name = item.getName();
       String address = item.getAddress();
  
       if (convertView == null) {
         placeView = new RelativeLayout(getContext());
         String inflater = Context.LAYOUT_INFLATER_SERVICE;
         LayoutInflater vi = (LayoutInflater)getContext().getSystemService(inflater);
         vi.inflate(resource, placeView, true);
       } 
       else 
       {
         placeView = (RelativeLayout) convertView;
       }
  
       TextView nameText = (TextView)placeView.findViewById(R.id.placeNamwView);
       Button button = (Button)placeView.findViewById(R.id.Button01);
       addressText = (EditText)placeView.findViewById(R.id.placeAddressText);
  
       button.setOnClickListener(buttonClick);
       nameText.setText(name);
       addressText.setText(address);
  
       return placeView;
    }
  }
  </code></pre>