I applied cardview in my application to remove it. At that moment, when I scroll the right side, the map view goes and returns for one tenth of a second, and then the gain goes out, causing flickering.
My code is suitable for a touch list. I am updating Content resolver, also notifying the adapter.
SwipeableRecyclerViewTouchListener swipeTouchListener = new SwipeableRecyclerViewTouchListener(recyclerView, new SwipeableRecyclerViewTouchListener.SwipeListener() { @Override public boolean canSwipe(int position) { return true; } @Override public void onDismissedBySwipeRight(RecyclerView recyclerView, int[] reverseSortedPositions) { for (int position : reverseSortedPositions) { Post post = posts.get(position); post.setIsDeleted(true); getActivity().getContentResolver().update(PostsContract.PostEntry.buildUriForPost(posts.get(position).get_ID()), Utility.changePostToContentValue(post), "_id=" + post.get_ID(),null); posts.remove(position); adapter.notifyItemRemoved(position); } } }); recyclerView.addOnItemTouchListener(swipeTouchListener);
My onLoadFinished looks like this
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) { if(data!=null && data.getCount() != posts.size()){ posts.clear(); while (data.moveToNext()){ Post post = new Post(data); posts.add(post); adapter.notifyDataSetChanged(); } } }
When I set breakpoints. It works great in the onDismissedSwipeByRight handler, where the remote map is not displayed. But when it comes to the OnLoadFinished breakpoint, I see that the remote card has returned, and then automatically shuts off after the function is executed, even if the size of the Arraylist messages is exactly the same.
Since the deleted card returns for one tenth of a second. This causes flickering. Can someone tell me where I am going wrong?
source share