Issue
In my application i am adding the view dynamically to the linear layout. each view consists of one button if you click on that then view will be deleted. How to refresh the linear layout? because when i removed any view then the view's positions will be changed.
Solution
LinearLayout ll = findViewById(R.id.yourLinearLayout);
To remove any view you can use
ll.removeView(view)// to remove particular view
ll.removeViewAt(position);// to remove view from particular position
Use following logic to remove any view from layout
ll.post(new Runnable() {
public void run() {
ll.removeView(view);
}
});
Answered By - Sunil Kumar Sahoo
Answer Checked By - Mary Flores (JavaFixing Volunteer)