Skip to content

Commit 6b5947d

Browse files
committed
solved force close issue for deleting quiz item and then clicking on expand button for other item in list since the item for deleted position do not exist but the count for currentPosition was still referring to it.
1 parent 3fab896 commit 6b5947d

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

source-code/app/src/main/java/org/buildmlearn/toolkit/templates/QuizAdapter.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public View getView(final int position, View convertView, ViewGroup parent) {
103103
holder.questionIcon.setOnClickListener(new View.OnClickListener() {
104104
@Override
105105
public void onClick(View v) {
106-
if (expandedPostion >= 0 && expandedPostion != position) {
106+
if (expandedPostion >= 0 && expandedPostion != position && getItem(expandedPostion) != null) {
107107
getItem(expandedPostion).setIsSelected(false);
108108
}
109109
if (getItem(position).isSelected()) {
@@ -142,6 +142,7 @@ public void onClick(View v) {
142142
dialog.dismiss();
143143

144144
((TemplateEditor) context).restoreSelectedView();
145+
expandedPostion = -1;
145146
}
146147
});
147148

0 commit comments

Comments
 (0)