how to remove SwipeExecuteBehavior for some item in one RadListView

3 posts, 0 answers
  1. Xiaoming
    Xiaoming avatar
    9 posts
    Member since:
    Oct 2011

    Posted 29 Jul 2015 Link to this post

    I want to RadListView's some items don't add SwipeExecuteBehavior.I use listview.remove(SwipeExecuteBehavior)method,but when i swiped,it occured some error which I can't deal with.This is the error 

     java.lang.UnsupportedOperationException: Behavior is not attached to RadListView. Use RadListView's addBehavior method to attach it.
                at com.telerik.widget.list.ListViewBehavior.owner(
                at com.telerik.widget.list.SwipeExecuteBehavior$
                at android.os.Handler.handleCallback(
                at android.os.Handler.dispatchMessage(
                at android.os.Looper.loop(
                at java.lang.reflect.Method.invoke(Native Method)
                at java.lang.reflect.Method.invoke(

  2. Xiaoming
    Xiaoming avatar
    9 posts
    Member since:
    Oct 2011

    Posted 29 Jul 2015 in reply to Xiaoming Link to this post

    public void onBindSwipeContentHolder(ListViewHolder holder, int position) {
    super.onBindSwipeContentHolder(holder, position);
    if (allMainListViewItem.get(position).getEventType() == 4) {
    try {
    } catch (Exception ex) {
    Toast.makeText(mContext, "日期不能滑动", Toast.LENGTH_SHORT).show();
    } finally {
    Toast.makeText(mContext, "日期不能滑动", Toast.LENGTH_SHORT).show();


    This is  the code in application,I want to the eventType == 4's item do't swipe

  3. DevCraft R3 2016 release webinar banner
  4. Todor
    Todor avatar
    772 posts

    Posted 30 Jul 2015 Link to this post

    Hi Xiaoming,

    Thank you for your question.

    Yes, the exception that you get is caused by the fact that you remove the behavior. What you can do is, to override canSwipe in your adapter:

    public boolean canSwipe(int position) {
        return super.canSwipe(position) && allMainListViewItem.get(position).getEventType() != 4;

    I hope this information helps.

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top