Question 1:
A memory leak problem when doing an infinite loop of viewPager causes crashes after multiple loops
It starts to show after doing it several times
Skipped 31 frames! The application may be doing too much work on its main thread.
The main thread is doing too many things causing the thread to block,
The reason is that in the adapter, you cannot inflate a layout every time, and a reuse mechanism is also required.
int realPosition = position%list.size(); View view = findViewByPosition(container,realPosition);
private View findViewByPosition(ViewGroup container,int position){ for (View view : mViews) { if (((int)view.getTag()) == position&&view.getParent()==null){ return view; } } View view = LayoutInflater.from(container.getContext()).inflate(R.layout.group_list_item,null,false); view.setTag(position); mViews.add(view); return view; }