WebView is one of the features that are often used in Android application development. I have ever meet trouble that my hyperlink work in my…
Leave a CommentAnonimeact Blog Posts
Privacy Policy anonimeact built the Peta Ziarah app as an Ad Supported app. This SERVICE is provided by anonimeact at no cost and is intended…
Leave a CommentPrivacy Policy anonimeact built the Whasapan app as a Free app. This SERVICE is provided by anonimeact at no cost and is intended for use…
Leave a CommentPermasalahan ini terjadi karena Anda belum menambahkan path mysql ke dalam perintah CLI di terminal. Untuk menambahkan path tersebut, silakan lakukan perintah tersebut di terminal:…
Leave a CommentRecyclerView On Touch item listener
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
public interface ClickListener { void onClick(View view, int position); void onLongClick(View view, int position); } class RecyclerTouchListener implements RecyclerView.OnItemTouchListener { private ClickListener clicklistener; private GestureDetector gestureDetector; public RecyclerTouchListener(Context context, final RecyclerView recycleView, final ClickListener clicklistener) { this.clicklistener = clicklistener; gestureDetector = new GestureDetector(context, new GestureDetector.SimpleOnGestureListener() { @Override public boolean onSingleTapUp(MotionEvent e) { return true; } @Override public void onLongPress(MotionEvent e) { View child = recycleView.findChildViewUnder(e.getX(), e.getY()); if (child != null && clicklistener != null) { clicklistener.onLongClick(child, recycleView.getChildAdapterPosition(child)); } } }); } @Override public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) { View child = rv.findChildViewUnder(e.getX(), e.getY()); if (child != null && clicklistener != null && gestureDetector.onTouchEvent(e)) { clicklistener.onClick(child, rv.getChildAdapterPosition(child)); } return false; } @Override public void onTouchEvent(RecyclerView rv, MotionEvent e) { } @Override public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) { } } |
Pengaplikasian
1 2 3 4 5 6 7 8 9 10 11 12 |
recyclerView.addOnItemTouchListener(new RecyclerTouchListener(this, recyclerView, new ClickListener() { @Override public void onClick(View view, final int position) { // Do what do you want } @Override public void onLongClick(View view, int position) { // Do what do you want on long click item } })); |
Leave a Comment
Privacy Policy anonimeact built the Kamus Binnom app as a Free app. This SERVICE is provided by anonimeact at no cost and is intended for…
Leave a CommentPrivacy Policy anonimeact built the Sajak app as an Ad Supported app. This SERVICE is provided by anonimeact at no cost and is intended for…
Leave a CommentPrivacy Policy anonimeact built the UU Peradilan Agama app as an Ad Supported app. This SERVICE is provided by anonimeact at no cost and is…
Leave a CommentPrivacy Policy anonimeact built the Undang-undang Penyiaran app as an Ad Supported app. This SERVICE is provided by anonimeact at no cost and is intended…
Leave a CommentPrivacy Policy anonimeact built the Pancasila Sakti app as an Ad Supported app. This SERVICE is provided by anonimeact at no cost and is intended…
Leave a Comment