I have db with name of countries(for example).
My first goal is dynamically add textView for (each country) to linearLayout (android:layout_width="match_parent" android:layout_height="match_parent"). In fact adding is not a problem, but problem if the orientation of layout is horizontal and there is to much countries, but the width of layout is not enough to show all of them and they are hide!
So i need to add textViews dynamically, but if there is not enough space for new textView - add it in the next line or create new linearLayout.
I need to create new textView for each country cos than i want to make clickListener for each of them, and there is second goal...
the second goal is delete some of that textView by clicking on it, and the other textView must relocate to that empty space. Hope that my explanation is clear :) if not i will try another one.
so, i have idea how to add textView: every time when i add new textView - count the length of all previously added ones with this one and compare it with length of linearLayout, if the length of all textViews is less - add to this linLayout, else - create new lin layout and add textView there. I think this could work, it it looks ugly :) I hope there are must be more simply and pretty solution!
Talking about dynamically deleting textViews from layout - I have no idea how to do this correctly.
So I will be glad any solutions and ideas, thanks!

ListView/RecyclerViewdoes out of the box. Use that.ListVieworRecyclerView. There is no need to concern yourself with manually adding or deletingTextViews. In addition,TextViews should auto word-wrap anyway, so there is no need to create a separateTextViewfor each line.