Remove view from parent before trying to insert into a new container.
This commit is contained in:
parent
b1d1b7e31e
commit
b070e6962f
1 changed files with 7 additions and 0 deletions
|
@ -747,6 +747,7 @@ public class ConversationAdapter
|
|||
unbind();
|
||||
|
||||
if (view != null) {
|
||||
removeViewFromParent(view);
|
||||
container.addView(view);
|
||||
}
|
||||
}
|
||||
|
@ -754,6 +755,12 @@ public class ConversationAdapter
|
|||
void unbind() {
|
||||
container.removeAllViews();
|
||||
}
|
||||
|
||||
private void removeViewFromParent(@NonNull View view) {
|
||||
if (view.getParent() != null) {
|
||||
((ViewGroup) view.getParent()).removeView(view);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class PlaceholderViewHolder extends RecyclerView.ViewHolder {
|
||||
|
|
Loading…
Add table
Reference in a new issue