+ Reply to Thread
Results 1 to 2 of 2

Thread: android expandable list need help

  1. #1
    Junior Member
    Join Date
    Jun 2012
    Posts
    14

    android expandable list need help

    Code:
    public boolean onChildClick(ExpandableListView parent, View v,
            int groupPosition, int childPosition, long id) {
        Log.d(LOG_TAG, "onChildClick: " + childPosition);
    
        Button btnPlay=(Button)v.findViewById(R.id.Play);
        Button btnDelete=(Button)v.findViewById(R.id.Delete);
        Button btnEmail=(Button)v.findViewById(R.id.Email);
        btnPlay.setOnClickListener(new View.OnClickListener() {
    
            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub
                Toast.makeText(FindFilesByType.this, "u clicked play btn", Toast.LENGTH_LONG).show();               
            }
        });
    in to above code i've made expandable list into that first i've put some content and if it expand,it displays 3 button..

    PLAY,EMAIL and DELETE
    my problem is that it doesn't react on button click event
    what is i am missing?
    thank in advance

  2. #2
    Junior Member
    Join Date
    Jun 2012
    Posts
    15
    Well, I think, You should implement onClick of Button while overriding the getChildView()
    Code:
    public View getChildView(int groupPosition, int childPosition, boolean isLastChild,
                       View convertView, ViewGroup parent) {
            LinearLayout v = (LinearLayout) LayoutInflater.from(FindFilesByType.this).inflate(R.layout.row, null) ; //we assume your layout file name is row.xml
            Button btnPlay=(Button)v.findViewById(R.id.Play);
            Button btnDelete=(Button)v.findViewById(R.id.Delete);
            Button btnEmail=(Button)v.findViewById(R.id.Email);
            btnPlay.setOnClickListener(new View.OnClickListener() {
    
                @Override
                public void onClick(View arg0) {
                    // TODO Auto-generated method stub
                    Toast.makeText(FindFilesByType.this, "u clicked play btn", Toast.LENGTH_LONG).show();               
                }
            }); 
            return v;
    
    
    }

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts