Ur code seems to much complicated...... Y not u code separate activity for shows and episode ???
On Mar 30, 10:49 am, Kevin Anthony <[email protected]> wrote: > I have a nested listview to display information about TV shows > first the Root listview shows the TV show name > when you click on the show name, you get a list of Episodes for the > show, including a title, episode number, and episode name > if you click on a show, it opens up another activity > > I have two problems, first, if you open one of the Show Names, you can > click on the episodes and it handles it properly. However if you > close that show, and open a second, you can no longer click on > episodes, even earlier ones, that worked. > > Here is the BaseExpandableListAdapter Implementation: > > public class MyExpandableListAdapter extends BaseExpandableListAdapter > { > > private ArrayList<String> groups = new ArrayList<String>(); > private ArrayList<ArrayList<ArrayList<String>>> children = new > ArrayList<ArrayList<ArrayList<String>>>(); > private LayoutInflater mInflater; > > public MyExpandableListAdapter(Context context) { > groups.clear(); > mInflater = LayoutInflater.from(context); > for (int i = 0; i < group.size(); i++) { > groups.add(group.get(i)); > } > int k = 0; > for (int i = 0; i < group.size(); i++) { > ArrayList<ArrayList<String>> outer = new > ArrayList<ArrayList<String>>(); > while ((k < videoName.size()) > && > (videoName.get(k).equals(groups.get(i)))) { > ArrayList<String> inner = new > ArrayList<String>(); > inner.add(videoName.get(k)); > inner.add(videoEpsNumber.get(k)); > inner.add(videoEpsName.get(k)); > inner.add(videoLocation.get(k)); > outer.add(inner); > k++; > } > children.add(outer); > } > } > > public Object getChild(int groupPosition, int childPosition) { > return children.get(groupPosition).get(childPosition); > } > > public long getChildId(int groupPosition, int childPosition) { > return childPosition; > } > > public int getChildrenCount(int groupPosition) { > return children.get(groupPosition).size(); > } > > public TextView getGenericView() { > // Layout parameters for the ExpandableListView > AbsListView.LayoutParams lp = new > AbsListView.LayoutParams( > ViewGroup.LayoutParams.FILL_PARENT, > 64); > > TextView textView = new TextView(VideoList.this); > textView.setLayoutParams(lp); > // Center the text vertically > textView.setGravity(Gravity.CENTER_VERTICAL | > Gravity.LEFT); > // Set the text starting position > textView.setPadding(86, 0, 0, 0); > return textView; > } > > public View getChildView(int groupPosition, int childPosition, > boolean isLastChild, View convertView, > ViewGroup parent) { > > ViewHolder holder; > if (convertView == null) { > convertView = > mInflater.inflate(R.layout.listview, null); > holder = new ViewHolder(); > holder.title = (TextView) convertView > > .findViewById(R.id.TextView01); > holder.number = (TextView) convertView > > .findViewById(R.id.TextView02); > holder.name = (TextView) convertView > > .findViewById(R.id.TextView03); > convertView.setTag(holder); > } else { > convertView.setClickable(true); > holder = (ViewHolder) convertView.getTag(); > } > > > holder.title.setText(children.get(groupPosition).get(childPosition) > .get(0)); > holder.number.setText(children.get(groupPosition) > .get(childPosition).get(1)); > > holder.name.setText(children.get(groupPosition).get(childPosition) > .get(2)); > > return convertView; > } > > public Object getGroup(int groupPosition) { > return groups.get(groupPosition); > } > > public int getGroupCount() { > return groups.size(); > } > > public long getGroupId(int groupPosition) { > return groupPosition; > } > > public View getGroupView(int groupPosition, boolean > isExpanded, > View convertView, ViewGroup parent) { > TextView textView = getGenericView(); > textView.setText(getGroup(groupPosition).toString()); > return textView; > } > > public boolean isChildSelectable(int groupPosition, int > childPosition) { > return true; > } > > public boolean hasStableIds() { > return true; > } > > public int getlongID(int groupPosition, int childPosition) { > int retval = 0; > for (int i = 0; i < groupPosition; i++) { > retval += children.get(i).size(); > } > retval += childPosition; > > return retval; > } > > class ViewHolder { > TextView title; > TextView number; > TextView name; > } > } -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

