Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

My childitems not shown #54

Open
sennew opened this issue Mar 7, 2016 · 1 comment
Open

My childitems not shown #54

sennew opened this issue Mar 7, 2016 · 1 comment

Comments

@sennew
Copy link

sennew commented Mar 7, 2016

I have written an expandable adapter but my childitems aren't showed. Only my groupitem is shown.
I debugged everything and my childs are there in my groupitem.

`package com.projects.wens.kandoeteami.organisation.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.projects.wens.kandoeteami.R;
import com.projects.wens.kandoeteami.organisation.data.ChildHolder;
import com.projects.wens.kandoeteami.organisation.data.ChildItem;
import com.projects.wens.kandoeteami.organisation.data.GroupHolder;
import com.projects.wens.kandoeteami.organisation.data.GroupItem;

import java.util.List;

/**

  • Created by senne on 04/03/2016.
    */
    public class ExpandableListViewAdapter extends BaseExpandableListAdapter {
    private static final String PICASSO_BASEURL = "http://wildfly-teamiip2kdgbe.rhcloud.com/";
    private final LayoutInflater inflater;
    private List items;

    public ExpandableListViewAdapter(Context context){
    inflater = LayoutInflater.from(context);
    }

    public void setData(List items){
    this.items = items;
    }

    @OverRide
    public ChildItem getChild(int groupPosition, int childPosition) {
    return items.get(groupPosition).getChildren().get(childPosition);
    }

    @OverRide
    public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
    GroupHolder holder;
    GroupItem item = getGroup(groupPosition);
    if (convertView == null){
    holder = new GroupHolder();
    convertView = inflater.inflate(R.layout.expandable_list_group, parent, false);
    holder.title = (TextView) convertView.findViewById(R.id.expandable_title);
    convertView.setTag(holder);
    } else {
    holder = (GroupHolder) convertView.getTag();
    }
    holder.title.setText(item.getTitle());
    return convertView;
    }

    @OverRide
    public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
    ChildHolder holder;
    ChildItem item = getChild(groupPosition, childPosition);
    TextView viewVoornaam;
    TextView viewActernaam;
    TextView viewOrganisator;
    if (convertView == null){
    holder = new ChildHolder();
    convertView = (RelativeLayout)inflater.inflate(R.layout.expandable_list_item, parent, false);
    }

    viewVoornaam = (TextView) convertView.findViewById(R.id.textVoornaam);
    viewActernaam = (TextView) convertView.findViewById(R.id.textAchternaam);
    viewOrganisator = (TextView) convertView.findViewById(R.id.textMemberOrganisator);
    
    viewVoornaam.setText(item.getFirstName());
    viewActernaam.setText(item.getLastName());
    viewOrganisator.setText(item.getRole());
    /*if (item.profilePictureUrl.charAt(0) == 'h'){
        Picasso.with(convertView.getContext()).load(item.profilePictureUrl).into(holder.profilePicture);
    } else{
        Picasso.with(convertView.getContext()).load(PICASSO_BASEURL + item.profilePictureUrl).into(holder.profilePicture);
    }*/
    return convertView;
    

    }

    @OverRide
    public long getChildId(int groupPosition, int childPosition) {
    return childPosition;
    }

    @OverRide
    public int getGroupCount() {
    return items.size();
    }

    @OverRide
    public int getChildrenCount(int groupPosition) {
    return items.get(groupPosition).children.size();
    }

    @OverRide
    public GroupItem getGroup(int groupPosition) {
    return items.get(groupPosition);
    }

    @OverRide
    public long getGroupId(int groupPosition) {
    return groupPosition;
    }

    @OverRide
    public boolean hasStableIds() {
    return false;
    }

    @OverRide
    public boolean isChildSelectable(int groupPosition, int childPosition) {
    return false;
    }
    }
    `

@sennew sennew changed the title My childitems not show My childitems not shown Mar 7, 2016
@onionYJK
Copy link

I run into the same problem. Did you find a solution? @sennew

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants