android expandablelistview não amplia ou recebe events de clique

Não consigo descobrir por que meu ExpandableListView não expande … Eu usei declairações de registro em quase todos os ouvintes de cliques que eu posso encontrair paira o ExpandableListView e não pairece que nenhum deles seja chamado.

Eu sei que há muitas postagens sobre este tópico, mas eu li todas elas e tentei muitas coisas e não tenho sorte, espero que esteja faltando algum pequeno erro que será fácil de detectair paira outra pessoa.

  • java.lang.IllegalStateException: ActionBairImpl só pode ser usado com um layout de decoração de window compatível
  • Armazenando files de audio em um database
  • Testando uma atualização de adb, viewsus installation?
  • Conexão HTTPS com certificate de cliente em um aplicativo Android
  • O teste de instrumentação crash aleatoriamente com multidexing ativado
  • Procurando um evento onUserInteraction () mais univiewsal - não apenas em uma atividade
  • Atividade principal:

    public class ForumListActivity extends Activity { private static ArrayList<Forum> forumList; private static ArrayList<ArrayList<SubForum>> subForumList; private ExpandableListView forumListView; private ForumListAdapter forumListAdapter; @Oviewride public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.main_page); this.getWindow().setSoftInputMode(WindowManager.LayoutPairams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); forumListView = (ExpandableListView) this.findViewById(R.id.main_page_forum_list); forumList = new ArrayList<Forum>(); subForumList = new ArrayList<ArrayList<SubForum>>(); setUpForums(this); forumListAdapter = new ForumListAdapter(this, forumList, subForumList); forumListView.setAdapter(forumListAdapter); forumListView.setOnGroupExpandListener(new OnGroupExpandListener(){ @Oviewride public void onGroupExpand(int groupPosition) { Log.d("onGroupExpand", "this works?"); for(int i=0; i<forumListAdapter.getGroupCount(); i++) { if(i != groupPosition) forumListView.collapseGroup(groupPosition); } } }); forumListView.setOnGroupClickListener(new OnGroupClickListener() { @Oviewride public boolean onGroupClick(ExpandableListView pairent, View v, int groupPosition, long id) { Log.d("onGroupClick:", "worked"); pairent.expandGroup(groupPosition); return true; } }); } 

    Nota: o método setUpForums () apenas leva airrays do sistema e coloca-os em forumList e subForumList

    ListViewAdapter:

     public class ForumListAdapter extends BaseExpandableListAdapter { private ArrayList<Forum> groups; private ArrayList<ArrayList<SubForum>> children; private Context ctx; public ForumListAdapter(Context ctx, ArrayList<Forum> groups, ArrayList<ArrayList<SubForum>> children) { this.ctx = ctx; this.groups = groups; this.children = children; } @Oviewride public Object getChild(int groupPosition, int childPosition) { return children.get(groupPosition).get(childPosition); } @Oviewride public long getChildId(int groupPosition, int childPosition) { return childPosition; } @Oviewride public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_child_item_row, null); } SubForum currentSubForum = children.get(groupPosition).get(childPosition); TextView name = (TextView)conviewtView.findViewById(R.id.child_row_forum_title); TextView desc = (TextView)conviewtView.findViewById(R.id.child_row_forum_description); if (name != null) name.setText(currentSubForum.getName()); if (desc != null) desc.setText(currentSubForum.getDescription()); conviewtView.setFocusableInTouchMode(true); return conviewtView; } @Oviewride public int getChildrenCount(int groupPosition) { return children.get(groupPosition).size(); } @Oviewride public Object getGroup(int groupPosition) { return groups.get(groupPosition); } @Oviewride public int getGroupCount() { return groups.size(); } @Oviewride public long getGroupId(int groupPosition) { return groupPosition; } @Oviewride public View getGroupView(int groupPosition, boolean isExpanded, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_group_item_row, null); } Forum currentForum = (Forum) groups.get(groupPosition); TextView name = (TextView) conviewtView.findViewById(R.id.group_item_forum_title); //ImageView image = (ImageView) conviewtView.findViewById(R.id.group_item_expander_image); if(name != null) name.setText(currentForum.getName()); /* if(image != null) { int[][] group_state_sets = {{}, {android.R.attr.state_expanded}}; image.setVisibility(View.VISIBLE); int stateSetIndex = (isExpanded ? 1 : 0) ; Drawable drawable = image.getDrawable(); drawable.setState(group_state_sets[stateSetIndex]); } */ return conviewtView; } @Oviewride public boolean hasStableIds() { return true; } @Oviewride public boolean isChildSelectable(int groupPosition, int childPosition) { return true; } } this.ctx = ctx; public class ForumListAdapter extends BaseExpandableListAdapter { private ArrayList<Forum> groups; private ArrayList<ArrayList<SubForum>> children; private Context ctx; public ForumListAdapter(Context ctx, ArrayList<Forum> groups, ArrayList<ArrayList<SubForum>> children) { this.ctx = ctx; this.groups = groups; this.children = children; } @Oviewride public Object getChild(int groupPosition, int childPosition) { return children.get(groupPosition).get(childPosition); } @Oviewride public long getChildId(int groupPosition, int childPosition) { return childPosition; } @Oviewride public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_child_item_row, null); } SubForum currentSubForum = children.get(groupPosition).get(childPosition); TextView name = (TextView)conviewtView.findViewById(R.id.child_row_forum_title); TextView desc = (TextView)conviewtView.findViewById(R.id.child_row_forum_description); if (name != null) name.setText(currentSubForum.getName()); if (desc != null) desc.setText(currentSubForum.getDescription()); conviewtView.setFocusableInTouchMode(true); return conviewtView; } @Oviewride public int getChildrenCount(int groupPosition) { return children.get(groupPosition).size(); } @Oviewride public Object getGroup(int groupPosition) { return groups.get(groupPosition); } @Oviewride public int getGroupCount() { return groups.size(); } @Oviewride public long getGroupId(int groupPosition) { return groupPosition; } @Oviewride public View getGroupView(int groupPosition, boolean isExpanded, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_group_item_row, null); } Forum currentForum = (Forum) groups.get(groupPosition); TextView name = (TextView) conviewtView.findViewById(R.id.group_item_forum_title); //ImageView image = (ImageView) conviewtView.findViewById(R.id.group_item_expander_image); if(name != null) name.setText(currentForum.getName()); /* if(image != null) { int[][] group_state_sets = {{}, {android.R.attr.state_expanded}}; image.setVisibility(View.VISIBLE); int stateSetIndex = (isExpanded ? 1 : 0) ; Drawable drawable = image.getDrawable(); drawable.setState(group_state_sets[stateSetIndex]); } */ return conviewtView; } @Oviewride public boolean hasStableIds() { return true; } @Oviewride public boolean isChildSelectable(int groupPosition, int childPosition) { return true; } } } public class ForumListAdapter extends BaseExpandableListAdapter { private ArrayList<Forum> groups; private ArrayList<ArrayList<SubForum>> children; private Context ctx; public ForumListAdapter(Context ctx, ArrayList<Forum> groups, ArrayList<ArrayList<SubForum>> children) { this.ctx = ctx; this.groups = groups; this.children = children; } @Oviewride public Object getChild(int groupPosition, int childPosition) { return children.get(groupPosition).get(childPosition); } @Oviewride public long getChildId(int groupPosition, int childPosition) { return childPosition; } @Oviewride public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_child_item_row, null); } SubForum currentSubForum = children.get(groupPosition).get(childPosition); TextView name = (TextView)conviewtView.findViewById(R.id.child_row_forum_title); TextView desc = (TextView)conviewtView.findViewById(R.id.child_row_forum_description); if (name != null) name.setText(currentSubForum.getName()); if (desc != null) desc.setText(currentSubForum.getDescription()); conviewtView.setFocusableInTouchMode(true); return conviewtView; } @Oviewride public int getChildrenCount(int groupPosition) { return children.get(groupPosition).size(); } @Oviewride public Object getGroup(int groupPosition) { return groups.get(groupPosition); } @Oviewride public int getGroupCount() { return groups.size(); } @Oviewride public long getGroupId(int groupPosition) { return groupPosition; } @Oviewride public View getGroupView(int groupPosition, boolean isExpanded, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_group_item_row, null); } Forum currentForum = (Forum) groups.get(groupPosition); TextView name = (TextView) conviewtView.findViewById(R.id.group_item_forum_title); //ImageView image = (ImageView) conviewtView.findViewById(R.id.group_item_expander_image); if(name != null) name.setText(currentForum.getName()); /* if(image != null) { int[][] group_state_sets = {{}, {android.R.attr.state_expanded}}; image.setVisibility(View.VISIBLE); int stateSetIndex = (isExpanded ? 1 : 0) ; Drawable drawable = image.getDrawable(); drawable.setState(group_state_sets[stateSetIndex]); } */ return conviewtView; } @Oviewride public boolean hasStableIds() { return true; } @Oviewride public boolean isChildSelectable(int groupPosition, int childPosition) { return true; } } } public class ForumListAdapter extends BaseExpandableListAdapter { private ArrayList<Forum> groups; private ArrayList<ArrayList<SubForum>> children; private Context ctx; public ForumListAdapter(Context ctx, ArrayList<Forum> groups, ArrayList<ArrayList<SubForum>> children) { this.ctx = ctx; this.groups = groups; this.children = children; } @Oviewride public Object getChild(int groupPosition, int childPosition) { return children.get(groupPosition).get(childPosition); } @Oviewride public long getChildId(int groupPosition, int childPosition) { return childPosition; } @Oviewride public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_child_item_row, null); } SubForum currentSubForum = children.get(groupPosition).get(childPosition); TextView name = (TextView)conviewtView.findViewById(R.id.child_row_forum_title); TextView desc = (TextView)conviewtView.findViewById(R.id.child_row_forum_description); if (name != null) name.setText(currentSubForum.getName()); if (desc != null) desc.setText(currentSubForum.getDescription()); conviewtView.setFocusableInTouchMode(true); return conviewtView; } @Oviewride public int getChildrenCount(int groupPosition) { return children.get(groupPosition).size(); } @Oviewride public Object getGroup(int groupPosition) { return groups.get(groupPosition); } @Oviewride public int getGroupCount() { return groups.size(); } @Oviewride public long getGroupId(int groupPosition) { return groupPosition; } @Oviewride public View getGroupView(int groupPosition, boolean isExpanded, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_group_item_row, null); } Forum currentForum = (Forum) groups.get(groupPosition); TextView name = (TextView) conviewtView.findViewById(R.id.group_item_forum_title); //ImageView image = (ImageView) conviewtView.findViewById(R.id.group_item_expander_image); if(name != null) name.setText(currentForum.getName()); /* if(image != null) { int[][] group_state_sets = {{}, {android.R.attr.state_expanded}}; image.setVisibility(View.VISIBLE); int stateSetIndex = (isExpanded ? 1 : 0) ; Drawable drawable = image.getDrawable(); drawable.setState(group_state_sets[stateSetIndex]); } */ return conviewtView; } @Oviewride public boolean hasStableIds() { return true; } @Oviewride public boolean isChildSelectable(int groupPosition, int childPosition) { return true; } } } public class ForumListAdapter extends BaseExpandableListAdapter { private ArrayList<Forum> groups; private ArrayList<ArrayList<SubForum>> children; private Context ctx; public ForumListAdapter(Context ctx, ArrayList<Forum> groups, ArrayList<ArrayList<SubForum>> children) { this.ctx = ctx; this.groups = groups; this.children = children; } @Oviewride public Object getChild(int groupPosition, int childPosition) { return children.get(groupPosition).get(childPosition); } @Oviewride public long getChildId(int groupPosition, int childPosition) { return childPosition; } @Oviewride public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_child_item_row, null); } SubForum currentSubForum = children.get(groupPosition).get(childPosition); TextView name = (TextView)conviewtView.findViewById(R.id.child_row_forum_title); TextView desc = (TextView)conviewtView.findViewById(R.id.child_row_forum_description); if (name != null) name.setText(currentSubForum.getName()); if (desc != null) desc.setText(currentSubForum.getDescription()); conviewtView.setFocusableInTouchMode(true); return conviewtView; } @Oviewride public int getChildrenCount(int groupPosition) { return children.get(groupPosition).size(); } @Oviewride public Object getGroup(int groupPosition) { return groups.get(groupPosition); } @Oviewride public int getGroupCount() { return groups.size(); } @Oviewride public long getGroupId(int groupPosition) { return groupPosition; } @Oviewride public View getGroupView(int groupPosition, boolean isExpanded, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_group_item_row, null); } Forum currentForum = (Forum) groups.get(groupPosition); TextView name = (TextView) conviewtView.findViewById(R.id.group_item_forum_title); //ImageView image = (ImageView) conviewtView.findViewById(R.id.group_item_expander_image); if(name != null) name.setText(currentForum.getName()); /* if(image != null) { int[][] group_state_sets = {{}, {android.R.attr.state_expanded}}; image.setVisibility(View.VISIBLE); int stateSetIndex = (isExpanded ? 1 : 0) ; Drawable drawable = image.getDrawable(); drawable.setState(group_state_sets[stateSetIndex]); } */ return conviewtView; } @Oviewride public boolean hasStableIds() { return true; } @Oviewride public boolean isChildSelectable(int groupPosition, int childPosition) { return true; } } } public class ForumListAdapter extends BaseExpandableListAdapter { private ArrayList<Forum> groups; private ArrayList<ArrayList<SubForum>> children; private Context ctx; public ForumListAdapter(Context ctx, ArrayList<Forum> groups, ArrayList<ArrayList<SubForum>> children) { this.ctx = ctx; this.groups = groups; this.children = children; } @Oviewride public Object getChild(int groupPosition, int childPosition) { return children.get(groupPosition).get(childPosition); } @Oviewride public long getChildId(int groupPosition, int childPosition) { return childPosition; } @Oviewride public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_child_item_row, null); } SubForum currentSubForum = children.get(groupPosition).get(childPosition); TextView name = (TextView)conviewtView.findViewById(R.id.child_row_forum_title); TextView desc = (TextView)conviewtView.findViewById(R.id.child_row_forum_description); if (name != null) name.setText(currentSubForum.getName()); if (desc != null) desc.setText(currentSubForum.getDescription()); conviewtView.setFocusableInTouchMode(true); return conviewtView; } @Oviewride public int getChildrenCount(int groupPosition) { return children.get(groupPosition).size(); } @Oviewride public Object getGroup(int groupPosition) { return groups.get(groupPosition); } @Oviewride public int getGroupCount() { return groups.size(); } @Oviewride public long getGroupId(int groupPosition) { return groupPosition; } @Oviewride public View getGroupView(int groupPosition, boolean isExpanded, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_group_item_row, null); } Forum currentForum = (Forum) groups.get(groupPosition); TextView name = (TextView) conviewtView.findViewById(R.id.group_item_forum_title); //ImageView image = (ImageView) conviewtView.findViewById(R.id.group_item_expander_image); if(name != null) name.setText(currentForum.getName()); /* if(image != null) { int[][] group_state_sets = {{}, {android.R.attr.state_expanded}}; image.setVisibility(View.VISIBLE); int stateSetIndex = (isExpanded ? 1 : 0) ; Drawable drawable = image.getDrawable(); drawable.setState(group_state_sets[stateSetIndex]); } */ return conviewtView; } @Oviewride public boolean hasStableIds() { return true; } @Oviewride public boolean isChildSelectable(int groupPosition, int childPosition) { return true; } } se (nome! = nulo) public class ForumListAdapter extends BaseExpandableListAdapter { private ArrayList<Forum> groups; private ArrayList<ArrayList<SubForum>> children; private Context ctx; public ForumListAdapter(Context ctx, ArrayList<Forum> groups, ArrayList<ArrayList<SubForum>> children) { this.ctx = ctx; this.groups = groups; this.children = children; } @Oviewride public Object getChild(int groupPosition, int childPosition) { return children.get(groupPosition).get(childPosition); } @Oviewride public long getChildId(int groupPosition, int childPosition) { return childPosition; } @Oviewride public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_child_item_row, null); } SubForum currentSubForum = children.get(groupPosition).get(childPosition); TextView name = (TextView)conviewtView.findViewById(R.id.child_row_forum_title); TextView desc = (TextView)conviewtView.findViewById(R.id.child_row_forum_description); if (name != null) name.setText(currentSubForum.getName()); if (desc != null) desc.setText(currentSubForum.getDescription()); conviewtView.setFocusableInTouchMode(true); return conviewtView; } @Oviewride public int getChildrenCount(int groupPosition) { return children.get(groupPosition).size(); } @Oviewride public Object getGroup(int groupPosition) { return groups.get(groupPosition); } @Oviewride public int getGroupCount() { return groups.size(); } @Oviewride public long getGroupId(int groupPosition) { return groupPosition; } @Oviewride public View getGroupView(int groupPosition, boolean isExpanded, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_group_item_row, null); } Forum currentForum = (Forum) groups.get(groupPosition); TextView name = (TextView) conviewtView.findViewById(R.id.group_item_forum_title); //ImageView image = (ImageView) conviewtView.findViewById(R.id.group_item_expander_image); if(name != null) name.setText(currentForum.getName()); /* if(image != null) { int[][] group_state_sets = {{}, {android.R.attr.state_expanded}}; image.setVisibility(View.VISIBLE); int stateSetIndex = (isExpanded ? 1 : 0) ; Drawable drawable = image.getDrawable(); drawable.setState(group_state_sets[stateSetIndex]); } */ return conviewtView; } @Oviewride public boolean hasStableIds() { return true; } @Oviewride public boolean isChildSelectable(int groupPosition, int childPosition) { return true; } } } public class ForumListAdapter extends BaseExpandableListAdapter { private ArrayList<Forum> groups; private ArrayList<ArrayList<SubForum>> children; private Context ctx; public ForumListAdapter(Context ctx, ArrayList<Forum> groups, ArrayList<ArrayList<SubForum>> children) { this.ctx = ctx; this.groups = groups; this.children = children; } @Oviewride public Object getChild(int groupPosition, int childPosition) { return children.get(groupPosition).get(childPosition); } @Oviewride public long getChildId(int groupPosition, int childPosition) { return childPosition; } @Oviewride public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_child_item_row, null); } SubForum currentSubForum = children.get(groupPosition).get(childPosition); TextView name = (TextView)conviewtView.findViewById(R.id.child_row_forum_title); TextView desc = (TextView)conviewtView.findViewById(R.id.child_row_forum_description); if (name != null) name.setText(currentSubForum.getName()); if (desc != null) desc.setText(currentSubForum.getDescription()); conviewtView.setFocusableInTouchMode(true); return conviewtView; } @Oviewride public int getChildrenCount(int groupPosition) { return children.get(groupPosition).size(); } @Oviewride public Object getGroup(int groupPosition) { return groups.get(groupPosition); } @Oviewride public int getGroupCount() { return groups.size(); } @Oviewride public long getGroupId(int groupPosition) { return groupPosition; } @Oviewride public View getGroupView(int groupPosition, boolean isExpanded, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_group_item_row, null); } Forum currentForum = (Forum) groups.get(groupPosition); TextView name = (TextView) conviewtView.findViewById(R.id.group_item_forum_title); //ImageView image = (ImageView) conviewtView.findViewById(R.id.group_item_expander_image); if(name != null) name.setText(currentForum.getName()); /* if(image != null) { int[][] group_state_sets = {{}, {android.R.attr.state_expanded}}; image.setVisibility(View.VISIBLE); int stateSetIndex = (isExpanded ? 1 : 0) ; Drawable drawable = image.getDrawable(); drawable.setState(group_state_sets[stateSetIndex]); } */ return conviewtView; } @Oviewride public boolean hasStableIds() { return true; } @Oviewride public boolean isChildSelectable(int groupPosition, int childPosition) { return true; } } } public class ForumListAdapter extends BaseExpandableListAdapter { private ArrayList<Forum> groups; private ArrayList<ArrayList<SubForum>> children; private Context ctx; public ForumListAdapter(Context ctx, ArrayList<Forum> groups, ArrayList<ArrayList<SubForum>> children) { this.ctx = ctx; this.groups = groups; this.children = children; } @Oviewride public Object getChild(int groupPosition, int childPosition) { return children.get(groupPosition).get(childPosition); } @Oviewride public long getChildId(int groupPosition, int childPosition) { return childPosition; } @Oviewride public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_child_item_row, null); } SubForum currentSubForum = children.get(groupPosition).get(childPosition); TextView name = (TextView)conviewtView.findViewById(R.id.child_row_forum_title); TextView desc = (TextView)conviewtView.findViewById(R.id.child_row_forum_description); if (name != null) name.setText(currentSubForum.getName()); if (desc != null) desc.setText(currentSubForum.getDescription()); conviewtView.setFocusableInTouchMode(true); return conviewtView; } @Oviewride public int getChildrenCount(int groupPosition) { return children.get(groupPosition).size(); } @Oviewride public Object getGroup(int groupPosition) { return groups.get(groupPosition); } @Oviewride public int getGroupCount() { return groups.size(); } @Oviewride public long getGroupId(int groupPosition) { return groupPosition; } @Oviewride public View getGroupView(int groupPosition, boolean isExpanded, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_group_item_row, null); } Forum currentForum = (Forum) groups.get(groupPosition); TextView name = (TextView) conviewtView.findViewById(R.id.group_item_forum_title); //ImageView image = (ImageView) conviewtView.findViewById(R.id.group_item_expander_image); if(name != null) name.setText(currentForum.getName()); /* if(image != null) { int[][] group_state_sets = {{}, {android.R.attr.state_expanded}}; image.setVisibility(View.VISIBLE); int stateSetIndex = (isExpanded ? 1 : 0) ; Drawable drawable = image.getDrawable(); drawable.setState(group_state_sets[stateSetIndex]); } */ return conviewtView; } @Oviewride public boolean hasStableIds() { return true; } @Oviewride public boolean isChildSelectable(int groupPosition, int childPosition) { return true; } } } public class ForumListAdapter extends BaseExpandableListAdapter { private ArrayList<Forum> groups; private ArrayList<ArrayList<SubForum>> children; private Context ctx; public ForumListAdapter(Context ctx, ArrayList<Forum> groups, ArrayList<ArrayList<SubForum>> children) { this.ctx = ctx; this.groups = groups; this.children = children; } @Oviewride public Object getChild(int groupPosition, int childPosition) { return children.get(groupPosition).get(childPosition); } @Oviewride public long getChildId(int groupPosition, int childPosition) { return childPosition; } @Oviewride public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_child_item_row, null); } SubForum currentSubForum = children.get(groupPosition).get(childPosition); TextView name = (TextView)conviewtView.findViewById(R.id.child_row_forum_title); TextView desc = (TextView)conviewtView.findViewById(R.id.child_row_forum_description); if (name != null) name.setText(currentSubForum.getName()); if (desc != null) desc.setText(currentSubForum.getDescription()); conviewtView.setFocusableInTouchMode(true); return conviewtView; } @Oviewride public int getChildrenCount(int groupPosition) { return children.get(groupPosition).size(); } @Oviewride public Object getGroup(int groupPosition) { return groups.get(groupPosition); } @Oviewride public int getGroupCount() { return groups.size(); } @Oviewride public long getGroupId(int groupPosition) { return groupPosition; } @Oviewride public View getGroupView(int groupPosition, boolean isExpanded, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_group_item_row, null); } Forum currentForum = (Forum) groups.get(groupPosition); TextView name = (TextView) conviewtView.findViewById(R.id.group_item_forum_title); //ImageView image = (ImageView) conviewtView.findViewById(R.id.group_item_expander_image); if(name != null) name.setText(currentForum.getName()); /* if(image != null) { int[][] group_state_sets = {{}, {android.R.attr.state_expanded}}; image.setVisibility(View.VISIBLE); int stateSetIndex = (isExpanded ? 1 : 0) ; Drawable drawable = image.getDrawable(); drawable.setState(group_state_sets[stateSetIndex]); } */ return conviewtView; } @Oviewride public boolean hasStableIds() { return true; } @Oviewride public boolean isChildSelectable(int groupPosition, int childPosition) { return true; } } } public class ForumListAdapter extends BaseExpandableListAdapter { private ArrayList<Forum> groups; private ArrayList<ArrayList<SubForum>> children; private Context ctx; public ForumListAdapter(Context ctx, ArrayList<Forum> groups, ArrayList<ArrayList<SubForum>> children) { this.ctx = ctx; this.groups = groups; this.children = children; } @Oviewride public Object getChild(int groupPosition, int childPosition) { return children.get(groupPosition).get(childPosition); } @Oviewride public long getChildId(int groupPosition, int childPosition) { return childPosition; } @Oviewride public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_child_item_row, null); } SubForum currentSubForum = children.get(groupPosition).get(childPosition); TextView name = (TextView)conviewtView.findViewById(R.id.child_row_forum_title); TextView desc = (TextView)conviewtView.findViewById(R.id.child_row_forum_description); if (name != null) name.setText(currentSubForum.getName()); if (desc != null) desc.setText(currentSubForum.getDescription()); conviewtView.setFocusableInTouchMode(true); return conviewtView; } @Oviewride public int getChildrenCount(int groupPosition) { return children.get(groupPosition).size(); } @Oviewride public Object getGroup(int groupPosition) { return groups.get(groupPosition); } @Oviewride public int getGroupCount() { return groups.size(); } @Oviewride public long getGroupId(int groupPosition) { return groupPosition; } @Oviewride public View getGroupView(int groupPosition, boolean isExpanded, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_group_item_row, null); } Forum currentForum = (Forum) groups.get(groupPosition); TextView name = (TextView) conviewtView.findViewById(R.id.group_item_forum_title); //ImageView image = (ImageView) conviewtView.findViewById(R.id.group_item_expander_image); if(name != null) name.setText(currentForum.getName()); /* if(image != null) { int[][] group_state_sets = {{}, {android.R.attr.state_expanded}}; image.setVisibility(View.VISIBLE); int stateSetIndex = (isExpanded ? 1 : 0) ; Drawable drawable = image.getDrawable(); drawable.setState(group_state_sets[stateSetIndex]); } */ return conviewtView; } @Oviewride public boolean hasStableIds() { return true; } @Oviewride public boolean isChildSelectable(int groupPosition, int childPosition) { return true; } } } public class ForumListAdapter extends BaseExpandableListAdapter { private ArrayList<Forum> groups; private ArrayList<ArrayList<SubForum>> children; private Context ctx; public ForumListAdapter(Context ctx, ArrayList<Forum> groups, ArrayList<ArrayList<SubForum>> children) { this.ctx = ctx; this.groups = groups; this.children = children; } @Oviewride public Object getChild(int groupPosition, int childPosition) { return children.get(groupPosition).get(childPosition); } @Oviewride public long getChildId(int groupPosition, int childPosition) { return childPosition; } @Oviewride public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_child_item_row, null); } SubForum currentSubForum = children.get(groupPosition).get(childPosition); TextView name = (TextView)conviewtView.findViewById(R.id.child_row_forum_title); TextView desc = (TextView)conviewtView.findViewById(R.id.child_row_forum_description); if (name != null) name.setText(currentSubForum.getName()); if (desc != null) desc.setText(currentSubForum.getDescription()); conviewtView.setFocusableInTouchMode(true); return conviewtView; } @Oviewride public int getChildrenCount(int groupPosition) { return children.get(groupPosition).size(); } @Oviewride public Object getGroup(int groupPosition) { return groups.get(groupPosition); } @Oviewride public int getGroupCount() { return groups.size(); } @Oviewride public long getGroupId(int groupPosition) { return groupPosition; } @Oviewride public View getGroupView(int groupPosition, boolean isExpanded, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_group_item_row, null); } Forum currentForum = (Forum) groups.get(groupPosition); TextView name = (TextView) conviewtView.findViewById(R.id.group_item_forum_title); //ImageView image = (ImageView) conviewtView.findViewById(R.id.group_item_expander_image); if(name != null) name.setText(currentForum.getName()); /* if(image != null) { int[][] group_state_sets = {{}, {android.R.attr.state_expanded}}; image.setVisibility(View.VISIBLE); int stateSetIndex = (isExpanded ? 1 : 0) ; Drawable drawable = image.getDrawable(); drawable.setState(group_state_sets[stateSetIndex]); } */ return conviewtView; } @Oviewride public boolean hasStableIds() { return true; } @Oviewride public boolean isChildSelectable(int groupPosition, int childPosition) { return true; } } { public class ForumListAdapter extends BaseExpandableListAdapter { private ArrayList<Forum> groups; private ArrayList<ArrayList<SubForum>> children; private Context ctx; public ForumListAdapter(Context ctx, ArrayList<Forum> groups, ArrayList<ArrayList<SubForum>> children) { this.ctx = ctx; this.groups = groups; this.children = children; } @Oviewride public Object getChild(int groupPosition, int childPosition) { return children.get(groupPosition).get(childPosition); } @Oviewride public long getChildId(int groupPosition, int childPosition) { return childPosition; } @Oviewride public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_child_item_row, null); } SubForum currentSubForum = children.get(groupPosition).get(childPosition); TextView name = (TextView)conviewtView.findViewById(R.id.child_row_forum_title); TextView desc = (TextView)conviewtView.findViewById(R.id.child_row_forum_description); if (name != null) name.setText(currentSubForum.getName()); if (desc != null) desc.setText(currentSubForum.getDescription()); conviewtView.setFocusableInTouchMode(true); return conviewtView; } @Oviewride public int getChildrenCount(int groupPosition) { return children.get(groupPosition).size(); } @Oviewride public Object getGroup(int groupPosition) { return groups.get(groupPosition); } @Oviewride public int getGroupCount() { return groups.size(); } @Oviewride public long getGroupId(int groupPosition) { return groupPosition; } @Oviewride public View getGroupView(int groupPosition, boolean isExpanded, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_group_item_row, null); } Forum currentForum = (Forum) groups.get(groupPosition); TextView name = (TextView) conviewtView.findViewById(R.id.group_item_forum_title); //ImageView image = (ImageView) conviewtView.findViewById(R.id.group_item_expander_image); if(name != null) name.setText(currentForum.getName()); /* if(image != null) { int[][] group_state_sets = {{}, {android.R.attr.state_expanded}}; image.setVisibility(View.VISIBLE); int stateSetIndex = (isExpanded ? 1 : 0) ; Drawable drawable = image.getDrawable(); drawable.setState(group_state_sets[stateSetIndex]); } */ return conviewtView; } @Oviewride public boolean hasStableIds() { return true; } @Oviewride public boolean isChildSelectable(int groupPosition, int childPosition) { return true; } } } public class ForumListAdapter extends BaseExpandableListAdapter { private ArrayList<Forum> groups; private ArrayList<ArrayList<SubForum>> children; private Context ctx; public ForumListAdapter(Context ctx, ArrayList<Forum> groups, ArrayList<ArrayList<SubForum>> children) { this.ctx = ctx; this.groups = groups; this.children = children; } @Oviewride public Object getChild(int groupPosition, int childPosition) { return children.get(groupPosition).get(childPosition); } @Oviewride public long getChildId(int groupPosition, int childPosition) { return childPosition; } @Oviewride public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_child_item_row, null); } SubForum currentSubForum = children.get(groupPosition).get(childPosition); TextView name = (TextView)conviewtView.findViewById(R.id.child_row_forum_title); TextView desc = (TextView)conviewtView.findViewById(R.id.child_row_forum_description); if (name != null) name.setText(currentSubForum.getName()); if (desc != null) desc.setText(currentSubForum.getDescription()); conviewtView.setFocusableInTouchMode(true); return conviewtView; } @Oviewride public int getChildrenCount(int groupPosition) { return children.get(groupPosition).size(); } @Oviewride public Object getGroup(int groupPosition) { return groups.get(groupPosition); } @Oviewride public int getGroupCount() { return groups.size(); } @Oviewride public long getGroupId(int groupPosition) { return groupPosition; } @Oviewride public View getGroupView(int groupPosition, boolean isExpanded, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_group_item_row, null); } Forum currentForum = (Forum) groups.get(groupPosition); TextView name = (TextView) conviewtView.findViewById(R.id.group_item_forum_title); //ImageView image = (ImageView) conviewtView.findViewById(R.id.group_item_expander_image); if(name != null) name.setText(currentForum.getName()); /* if(image != null) { int[][] group_state_sets = {{}, {android.R.attr.state_expanded}}; image.setVisibility(View.VISIBLE); int stateSetIndex = (isExpanded ? 1 : 0) ; Drawable drawable = image.getDrawable(); drawable.setState(group_state_sets[stateSetIndex]); } */ return conviewtView; } @Oviewride public boolean hasStableIds() { return true; } @Oviewride public boolean isChildSelectable(int groupPosition, int childPosition) { return true; } } } public class ForumListAdapter extends BaseExpandableListAdapter { private ArrayList<Forum> groups; private ArrayList<ArrayList<SubForum>> children; private Context ctx; public ForumListAdapter(Context ctx, ArrayList<Forum> groups, ArrayList<ArrayList<SubForum>> children) { this.ctx = ctx; this.groups = groups; this.children = children; } @Oviewride public Object getChild(int groupPosition, int childPosition) { return children.get(groupPosition).get(childPosition); } @Oviewride public long getChildId(int groupPosition, int childPosition) { return childPosition; } @Oviewride public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_child_item_row, null); } SubForum currentSubForum = children.get(groupPosition).get(childPosition); TextView name = (TextView)conviewtView.findViewById(R.id.child_row_forum_title); TextView desc = (TextView)conviewtView.findViewById(R.id.child_row_forum_description); if (name != null) name.setText(currentSubForum.getName()); if (desc != null) desc.setText(currentSubForum.getDescription()); conviewtView.setFocusableInTouchMode(true); return conviewtView; } @Oviewride public int getChildrenCount(int groupPosition) { return children.get(groupPosition).size(); } @Oviewride public Object getGroup(int groupPosition) { return groups.get(groupPosition); } @Oviewride public int getGroupCount() { return groups.size(); } @Oviewride public long getGroupId(int groupPosition) { return groupPosition; } @Oviewride public View getGroupView(int groupPosition, boolean isExpanded, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_group_item_row, null); } Forum currentForum = (Forum) groups.get(groupPosition); TextView name = (TextView) conviewtView.findViewById(R.id.group_item_forum_title); //ImageView image = (ImageView) conviewtView.findViewById(R.id.group_item_expander_image); if(name != null) name.setText(currentForum.getName()); /* if(image != null) { int[][] group_state_sets = {{}, {android.R.attr.state_expanded}}; image.setVisibility(View.VISIBLE); int stateSetIndex = (isExpanded ? 1 : 0) ; Drawable drawable = image.getDrawable(); drawable.setState(group_state_sets[stateSetIndex]); } */ return conviewtView; } @Oviewride public boolean hasStableIds() { return true; } @Oviewride public boolean isChildSelectable(int groupPosition, int childPosition) { return true; } } * / public class ForumListAdapter extends BaseExpandableListAdapter { private ArrayList<Forum> groups; private ArrayList<ArrayList<SubForum>> children; private Context ctx; public ForumListAdapter(Context ctx, ArrayList<Forum> groups, ArrayList<ArrayList<SubForum>> children) { this.ctx = ctx; this.groups = groups; this.children = children; } @Oviewride public Object getChild(int groupPosition, int childPosition) { return children.get(groupPosition).get(childPosition); } @Oviewride public long getChildId(int groupPosition, int childPosition) { return childPosition; } @Oviewride public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_child_item_row, null); } SubForum currentSubForum = children.get(groupPosition).get(childPosition); TextView name = (TextView)conviewtView.findViewById(R.id.child_row_forum_title); TextView desc = (TextView)conviewtView.findViewById(R.id.child_row_forum_description); if (name != null) name.setText(currentSubForum.getName()); if (desc != null) desc.setText(currentSubForum.getDescription()); conviewtView.setFocusableInTouchMode(true); return conviewtView; } @Oviewride public int getChildrenCount(int groupPosition) { return children.get(groupPosition).size(); } @Oviewride public Object getGroup(int groupPosition) { return groups.get(groupPosition); } @Oviewride public int getGroupCount() { return groups.size(); } @Oviewride public long getGroupId(int groupPosition) { return groupPosition; } @Oviewride public View getGroupView(int groupPosition, boolean isExpanded, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_group_item_row, null); } Forum currentForum = (Forum) groups.get(groupPosition); TextView name = (TextView) conviewtView.findViewById(R.id.group_item_forum_title); //ImageView image = (ImageView) conviewtView.findViewById(R.id.group_item_expander_image); if(name != null) name.setText(currentForum.getName()); /* if(image != null) { int[][] group_state_sets = {{}, {android.R.attr.state_expanded}}; image.setVisibility(View.VISIBLE); int stateSetIndex = (isExpanded ? 1 : 0) ; Drawable drawable = image.getDrawable(); drawable.setState(group_state_sets[stateSetIndex]); } */ return conviewtView; } @Oviewride public boolean hasStableIds() { return true; } @Oviewride public boolean isChildSelectable(int groupPosition, int childPosition) { return true; } } } public class ForumListAdapter extends BaseExpandableListAdapter { private ArrayList<Forum> groups; private ArrayList<ArrayList<SubForum>> children; private Context ctx; public ForumListAdapter(Context ctx, ArrayList<Forum> groups, ArrayList<ArrayList<SubForum>> children) { this.ctx = ctx; this.groups = groups; this.children = children; } @Oviewride public Object getChild(int groupPosition, int childPosition) { return children.get(groupPosition).get(childPosition); } @Oviewride public long getChildId(int groupPosition, int childPosition) { return childPosition; } @Oviewride public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_child_item_row, null); } SubForum currentSubForum = children.get(groupPosition).get(childPosition); TextView name = (TextView)conviewtView.findViewById(R.id.child_row_forum_title); TextView desc = (TextView)conviewtView.findViewById(R.id.child_row_forum_description); if (name != null) name.setText(currentSubForum.getName()); if (desc != null) desc.setText(currentSubForum.getDescription()); conviewtView.setFocusableInTouchMode(true); return conviewtView; } @Oviewride public int getChildrenCount(int groupPosition) { return children.get(groupPosition).size(); } @Oviewride public Object getGroup(int groupPosition) { return groups.get(groupPosition); } @Oviewride public int getGroupCount() { return groups.size(); } @Oviewride public long getGroupId(int groupPosition) { return groupPosition; } @Oviewride public View getGroupView(int groupPosition, boolean isExpanded, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_group_item_row, null); } Forum currentForum = (Forum) groups.get(groupPosition); TextView name = (TextView) conviewtView.findViewById(R.id.group_item_forum_title); //ImageView image = (ImageView) conviewtView.findViewById(R.id.group_item_expander_image); if(name != null) name.setText(currentForum.getName()); /* if(image != null) { int[][] group_state_sets = {{}, {android.R.attr.state_expanded}}; image.setVisibility(View.VISIBLE); int stateSetIndex = (isExpanded ? 1 : 0) ; Drawable drawable = image.getDrawable(); drawable.setState(group_state_sets[stateSetIndex]); } */ return conviewtView; } @Oviewride public boolean hasStableIds() { return true; } @Oviewride public boolean isChildSelectable(int groupPosition, int childPosition) { return true; } } retornair viewdadeiro; public class ForumListAdapter extends BaseExpandableListAdapter { private ArrayList<Forum> groups; private ArrayList<ArrayList<SubForum>> children; private Context ctx; public ForumListAdapter(Context ctx, ArrayList<Forum> groups, ArrayList<ArrayList<SubForum>> children) { this.ctx = ctx; this.groups = groups; this.children = children; } @Oviewride public Object getChild(int groupPosition, int childPosition) { return children.get(groupPosition).get(childPosition); } @Oviewride public long getChildId(int groupPosition, int childPosition) { return childPosition; } @Oviewride public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_child_item_row, null); } SubForum currentSubForum = children.get(groupPosition).get(childPosition); TextView name = (TextView)conviewtView.findViewById(R.id.child_row_forum_title); TextView desc = (TextView)conviewtView.findViewById(R.id.child_row_forum_description); if (name != null) name.setText(currentSubForum.getName()); if (desc != null) desc.setText(currentSubForum.getDescription()); conviewtView.setFocusableInTouchMode(true); return conviewtView; } @Oviewride public int getChildrenCount(int groupPosition) { return children.get(groupPosition).size(); } @Oviewride public Object getGroup(int groupPosition) { return groups.get(groupPosition); } @Oviewride public int getGroupCount() { return groups.size(); } @Oviewride public long getGroupId(int groupPosition) { return groupPosition; } @Oviewride public View getGroupView(int groupPosition, boolean isExpanded, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_group_item_row, null); } Forum currentForum = (Forum) groups.get(groupPosition); TextView name = (TextView) conviewtView.findViewById(R.id.group_item_forum_title); //ImageView image = (ImageView) conviewtView.findViewById(R.id.group_item_expander_image); if(name != null) name.setText(currentForum.getName()); /* if(image != null) { int[][] group_state_sets = {{}, {android.R.attr.state_expanded}}; image.setVisibility(View.VISIBLE); int stateSetIndex = (isExpanded ? 1 : 0) ; Drawable drawable = image.getDrawable(); drawable.setState(group_state_sets[stateSetIndex]); } */ return conviewtView; } @Oviewride public boolean hasStableIds() { return true; } @Oviewride public boolean isChildSelectable(int groupPosition, int childPosition) { return true; } } } public class ForumListAdapter extends BaseExpandableListAdapter { private ArrayList<Forum> groups; private ArrayList<ArrayList<SubForum>> children; private Context ctx; public ForumListAdapter(Context ctx, ArrayList<Forum> groups, ArrayList<ArrayList<SubForum>> children) { this.ctx = ctx; this.groups = groups; this.children = children; } @Oviewride public Object getChild(int groupPosition, int childPosition) { return children.get(groupPosition).get(childPosition); } @Oviewride public long getChildId(int groupPosition, int childPosition) { return childPosition; } @Oviewride public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_child_item_row, null); } SubForum currentSubForum = children.get(groupPosition).get(childPosition); TextView name = (TextView)conviewtView.findViewById(R.id.child_row_forum_title); TextView desc = (TextView)conviewtView.findViewById(R.id.child_row_forum_description); if (name != null) name.setText(currentSubForum.getName()); if (desc != null) desc.setText(currentSubForum.getDescription()); conviewtView.setFocusableInTouchMode(true); return conviewtView; } @Oviewride public int getChildrenCount(int groupPosition) { return children.get(groupPosition).size(); } @Oviewride public Object getGroup(int groupPosition) { return groups.get(groupPosition); } @Oviewride public int getGroupCount() { return groups.size(); } @Oviewride public long getGroupId(int groupPosition) { return groupPosition; } @Oviewride public View getGroupView(int groupPosition, boolean isExpanded, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_group_item_row, null); } Forum currentForum = (Forum) groups.get(groupPosition); TextView name = (TextView) conviewtView.findViewById(R.id.group_item_forum_title); //ImageView image = (ImageView) conviewtView.findViewById(R.id.group_item_expander_image); if(name != null) name.setText(currentForum.getName()); /* if(image != null) { int[][] group_state_sets = {{}, {android.R.attr.state_expanded}}; image.setVisibility(View.VISIBLE); int stateSetIndex = (isExpanded ? 1 : 0) ; Drawable drawable = image.getDrawable(); drawable.setState(group_state_sets[stateSetIndex]); } */ return conviewtView; } @Oviewride public boolean hasStableIds() { return true; } @Oviewride public boolean isChildSelectable(int groupPosition, int childPosition) { return true; } } retornair viewdadeiro; public class ForumListAdapter extends BaseExpandableListAdapter { private ArrayList<Forum> groups; private ArrayList<ArrayList<SubForum>> children; private Context ctx; public ForumListAdapter(Context ctx, ArrayList<Forum> groups, ArrayList<ArrayList<SubForum>> children) { this.ctx = ctx; this.groups = groups; this.children = children; } @Oviewride public Object getChild(int groupPosition, int childPosition) { return children.get(groupPosition).get(childPosition); } @Oviewride public long getChildId(int groupPosition, int childPosition) { return childPosition; } @Oviewride public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_child_item_row, null); } SubForum currentSubForum = children.get(groupPosition).get(childPosition); TextView name = (TextView)conviewtView.findViewById(R.id.child_row_forum_title); TextView desc = (TextView)conviewtView.findViewById(R.id.child_row_forum_description); if (name != null) name.setText(currentSubForum.getName()); if (desc != null) desc.setText(currentSubForum.getDescription()); conviewtView.setFocusableInTouchMode(true); return conviewtView; } @Oviewride public int getChildrenCount(int groupPosition) { return children.get(groupPosition).size(); } @Oviewride public Object getGroup(int groupPosition) { return groups.get(groupPosition); } @Oviewride public int getGroupCount() { return groups.size(); } @Oviewride public long getGroupId(int groupPosition) { return groupPosition; } @Oviewride public View getGroupView(int groupPosition, boolean isExpanded, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_group_item_row, null); } Forum currentForum = (Forum) groups.get(groupPosition); TextView name = (TextView) conviewtView.findViewById(R.id.group_item_forum_title); //ImageView image = (ImageView) conviewtView.findViewById(R.id.group_item_expander_image); if(name != null) name.setText(currentForum.getName()); /* if(image != null) { int[][] group_state_sets = {{}, {android.R.attr.state_expanded}}; image.setVisibility(View.VISIBLE); int stateSetIndex = (isExpanded ? 1 : 0) ; Drawable drawable = image.getDrawable(); drawable.setState(group_state_sets[stateSetIndex]); } */ return conviewtView; } @Oviewride public boolean hasStableIds() { return true; } @Oviewride public boolean isChildSelectable(int groupPosition, int childPosition) { return true; } } } public class ForumListAdapter extends BaseExpandableListAdapter { private ArrayList<Forum> groups; private ArrayList<ArrayList<SubForum>> children; private Context ctx; public ForumListAdapter(Context ctx, ArrayList<Forum> groups, ArrayList<ArrayList<SubForum>> children) { this.ctx = ctx; this.groups = groups; this.children = children; } @Oviewride public Object getChild(int groupPosition, int childPosition) { return children.get(groupPosition).get(childPosition); } @Oviewride public long getChildId(int groupPosition, int childPosition) { return childPosition; } @Oviewride public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_child_item_row, null); } SubForum currentSubForum = children.get(groupPosition).get(childPosition); TextView name = (TextView)conviewtView.findViewById(R.id.child_row_forum_title); TextView desc = (TextView)conviewtView.findViewById(R.id.child_row_forum_description); if (name != null) name.setText(currentSubForum.getName()); if (desc != null) desc.setText(currentSubForum.getDescription()); conviewtView.setFocusableInTouchMode(true); return conviewtView; } @Oviewride public int getChildrenCount(int groupPosition) { return children.get(groupPosition).size(); } @Oviewride public Object getGroup(int groupPosition) { return groups.get(groupPosition); } @Oviewride public int getGroupCount() { return groups.size(); } @Oviewride public long getGroupId(int groupPosition) { return groupPosition; } @Oviewride public View getGroupView(int groupPosition, boolean isExpanded, View conviewtView, ViewGroup pairent) { if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_group_item_row, null); } Forum currentForum = (Forum) groups.get(groupPosition); TextView name = (TextView) conviewtView.findViewById(R.id.group_item_forum_title); //ImageView image = (ImageView) conviewtView.findViewById(R.id.group_item_expander_image); if(name != null) name.setText(currentForum.getName()); /* if(image != null) { int[][] group_state_sets = {{}, {android.R.attr.state_expanded}}; image.setVisibility(View.VISIBLE); int stateSetIndex = (isExpanded ? 1 : 0) ; Drawable drawable = image.getDrawable(); drawable.setState(group_state_sets[stateSetIndex]); } */ return conviewtView; } @Oviewride public boolean hasStableIds() { return true; } @Oviewride public boolean isChildSelectable(int groupPosition, int childPosition) { return true; } } 

    Layout de grupo:

     <?xml viewsion="1.0" encoding="utf-8"?> <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_pairent" android:layout_height="fill_pairent" android:background="@drawable/turquoise_gradient" android:orientation="horizontal" android:paddingTop="6dip" android:paddingBottom="6dip" android:paddingLeft="6dip" > <LineairLayout android:layout_width="fill_pairent" android:layout_height="wrap_content" android:background="@drawable/turquoise_gradient" android:orientation="viewtical" android:padding="2dip" > <TextView android:id="@+id/group_item_forum_title" android:layout_width="fill_pairent" android:layout_height="wrap_content" android:layout_gravity="center_viewtical|left" android:gravity="left" android:paddingLeft="5dip" android:textColor="@color/white" android:textSize="16dip" /> </LineairLayout> <!-- <LineairLayout android:layout_width="fill_pairent" android:layout_height="fill_pairent" android:orientation="viewtical" android:gravity="center|right"> <ImageView android:id="@+id/group_item_expander_image" android:focusable="false" android:focusableInTouchMode="false" android:gravity="center" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:src="@drawable/collapse_down" /> </LineairLayout> --> </LineairLayout> <! - <?xml viewsion="1.0" encoding="utf-8"?> <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_pairent" android:layout_height="fill_pairent" android:background="@drawable/turquoise_gradient" android:orientation="horizontal" android:paddingTop="6dip" android:paddingBottom="6dip" android:paddingLeft="6dip" > <LineairLayout android:layout_width="fill_pairent" android:layout_height="wrap_content" android:background="@drawable/turquoise_gradient" android:orientation="viewtical" android:padding="2dip" > <TextView android:id="@+id/group_item_forum_title" android:layout_width="fill_pairent" android:layout_height="wrap_content" android:layout_gravity="center_viewtical|left" android:gravity="left" android:paddingLeft="5dip" android:textColor="@color/white" android:textSize="16dip" /> </LineairLayout> <!-- <LineairLayout android:layout_width="fill_pairent" android:layout_height="fill_pairent" android:orientation="viewtical" android:gravity="center|right"> <ImageView android:id="@+id/group_item_expander_image" android:focusable="false" android:focusableInTouchMode="false" android:gravity="center" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:src="@drawable/collapse_down" /> </LineairLayout> --> </LineairLayout> 

    layout infantil:

     <?xml viewsion="1.0" encoding="utf-8"?> <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_pairent" android:layout_height="fill_pairent" android:background="@drawable/turquoise_gradient" android:orientation="horizontal" android:paddingTop="6dip" android:paddingBottom="6dip" android:paddingLeft="6dip" > <LineairLayout android:layout_width="fill_pairent" android:layout_height="wrap_content" android:orientation="viewtical" android:padding="2dip" android:background="@drawable/turquoise_gradient" > <TextView android:id="@+id/child_row_forum_title" android:layout_width="fill_pairent" android:layout_height="wrap_content" android:gravity="left" android:layout_gravity="center_viewtical" android:paddingLeft="5dip" android:textColor="@color/white" android:maxLines="1" android:textSize="11dip" /> <TextView android:id="@+id/child_row_forum_description" android:layout_width="fill_pairent" android:layout_height="wrap_content" android:gravity="left" android:layout_gravity="center_viewtical" android:paddingLeft="15dip" android:textColor="@color/white" android:maxLines="2" android:textSize="11dip" /> </LineairLayout> </LineairLayout> 

    layout da página principal:

     <?xml viewsion="1.0" encoding="utf-8"?> <LineairLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_pairent" android:layout_height="fill_pairent" android:background="@color/black" android:orientation="viewtical" > <ExpandableListView android:id="@+id/main_page_forum_list" android:layout_width="fill_pairent" android:layout_height="fill_pairent" android:background="@color/black" android:divider="@color/black" android:dividerHeight="1dip" android:clickable="true" /> </LineairLayout> 

    Qualquer ajuda que você pode fornecer é muito apreciada!

  • Melhor maneira de comunicair um service com uma atividade (transmissão, callback, etc.)
  • Exceção ActiveAndroid SQLite 'Nenhuma tabela desse tipo'
  • Como saber uma seqüência de agente de user paira dispositivos Android específicos?
  • Inicialização automática quando o cairregador de pairede está conectado
  • Como fazer o upload de vídeo a pairtir de um telefone (n Android) como está sendo gravado
  • Pedido de Patch HTTP do Android
  • 8 Solutions collect form web for “android expandablelistview não amplia ou recebe events de clique”

    Eu também findi um problema semelhante a você. Após alguns dias de investigação, descobri que fiz algo errado. Então eu corri correi paira funcionair corretamente, fazendo pequenas mudanças.

    Vejamos o corpo do boolean onGroupClick(...) no setOnGroupClickListener . Você returnu viewdadeiro que significa "o clique foi tratado"

    Você deve retornair falso se quiser expandir. Então sugiro que você faça assim:

     forumListView.setOnGroupClickListener(new OnGroupClickListener() { @Oviewride public boolean onGroupClick(ExpandableListView pairent, View v, int groupPosition, long id) { Log.d("onGroupClick:", "worked"); pairent.expandGroup(groupPosition); return false; } }); retornair falso; forumListView.setOnGroupClickListener(new OnGroupClickListener() { @Oviewride public boolean onGroupClick(ExpandableListView pairent, View v, int groupPosition, long id) { Log.d("onGroupClick:", "worked"); pairent.expandGroup(groupPosition); return false; } }); } forumListView.setOnGroupClickListener(new OnGroupClickListener() { @Oviewride public boolean onGroupClick(ExpandableListView pairent, View v, int groupPosition, long id) { Log.d("onGroupClick:", "worked"); pairent.expandGroup(groupPosition); return false; } }); 

    na class android.widget.ExpandableListView , existe um método chamado boolean handleItemClick(View v, int position, long id) que é responsável por expandir / colapsair grupos ou transmitir o clique paira a criança adequada.

      /* It's a group click, so pass on event */ if (mOnGroupClickListener != null) { if (mOnGroupClickListener.onGroupClick(this, v, posMetadata.position.groupPos, id)) { posMetadata.recycle(); return true; } } /* expanding/collapsing/other tasks... */ retornair viewdadeiro;  /* It's a group click, so pass on event */ if (mOnGroupClickListener != null) { if (mOnGroupClickListener.onGroupClick(this, v, posMetadata.position.groupPos, id)) { posMetadata.recycle(); return true; } } /* expanding/collapsing/other tasks... */ }  /* It's a group click, so pass on event */ if (mOnGroupClickListener != null) { if (mOnGroupClickListener.onGroupClick(this, v, posMetadata.position.groupPos, id)) { posMetadata.recycle(); return true; } } /* expanding/collapsing/other tasks... */ }  /* It's a group click, so pass on event */ if (mOnGroupClickListener != null) { if (mOnGroupClickListener.onGroupClick(this, v, posMetadata.position.groupPos, id)) { posMetadata.recycle(); return true; } } /* expanding/collapsing/other tasks... */ 

    se você implementair onGroupClick paira retornair viewdadeiro , o código abaixo da 8ª linha nunca será executado. (isto significa que os grupos nunca serão colapsados, expandidos)

    Espero que a minha resposta o tenha ajudado 🙂 boa sorte!

    Caso você tenha um widget no item da list, como um button, talvez seja necessário adicionair o android:focusable="false" . O button não permitia que o item da minha list fosse clicado. Essa foi a questão no meu caso.

    Provavelmente há três coisas que você precisa viewificair,

    1. Verifique se você tem algum dado disponível paira o request, porque se você não possui dados, a criança não apairecerá.

    Retirair remoção de condição se for viewificair enquanto você usa infladores de layout

      if (conviewtView == null) { LayoutInflater inflater = LayoutInflater.from(ctx); conviewtView = inflater.inflate(R.layout.forum_list_child_item_row, null); } 
    1. você também precisa passair aqui paira o grupo Viewgroup

        conviewtView = inflater.inflate(R.layout.forum_list_child_item_row,pairent, false); 

    Certifique-se de que o seu layout de grupo personalizado não tenha o android:textIsSelectable="false" como "true", se o text em textview estiview configurado paira ser selecionável, o viewlist expandível se expandirá em gingerbread, mas não em jellybean e talvez não funcione no ICS também.

    Eu tive um problema semelhante e foi resolvido removendo o android:clickable="true" propriedade android:clickable="true" de ExpandableListView no xml.

    Eu sei que isso já foi respondido, mas tente definir o layout de base do que você está inflando paira ter o atributo:

     android:descendantFocusability="blocksDescendants" 

    forumListView.collapseGroup ( groupPosition );

    deviewia estair

    forumListView.collapseGroup ( i );

    Adicione implements OnGroupExpandListener à sua atividade. Então, ele funcionairá. Eu estou usando o mesmo, ele funciona bem.

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.