は私がBaseExpandableListAdapter
notifyDataSetChangedはどのように機能しますか?
でnotifyDataSetChanged()
作品が、私はブール変数を更新しています方法についての質問があり、その出力はgetChildrenCount()
の出力が、
コードを呼び出すには変更されません見えたコメントの数を決定します:
buttonViewComments.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
allCommentsVisible = !allCommentsVisible;
notifyDataSetChanged();
}
});
getChildrenCount:
public int getChildrenCount(int groupPosition) {
if(allCommentsVisible || postList.get(groupPosition).commentListSize()<=3)
return postList.get(groupPosition).commentListSize();
else{
return 3;
}
}
アダプターのデータはありません。データアダプタ内に "allCommentsVisiable"の値を入力してください。 –
現在、それは "public class PostListAdapter extends BaseExpandableListAdapter"のプライベートメンバ変数です –
他のメンバー:プライベートリスト postList; プライベートコンテキストコンテキスト。 プライベートString SessionID; –