android - What is the cause of D/OpenGLRenderer: endAllActiveAnimators on MenuPopupWindow$MenuDropDownListView while implementing a contextmenu on cardview? -


on long press on card, menu setting in oncreatecontextmenu(), executing doesnt go inside onmenuitemclick() intend actions according option selected user.

on touching item in context menu, below error.

08-15 13:47:31.144 19269-19446/com.sagnikdas.nav d/openglrenderer: endallactiveanimators on 0x9d250d80 (menupopupwindow$menudropdownlistview) handle 0x8c51cfd0

below code: public class customadapter extends recyclerview.adapter {

public static final string extra_message = "com.sagnikdas.nav.customadapter.message"; private context context; private arraylist<mydata> my_data;  public customadapter(context context, arraylist<mydata> my_data) {     this.context = context;     this.my_data = my_data; }  @override public viewholder oncreateviewholder(viewgroup parent, int viewtype) {     view itemview = layoutinflater.from(parent.getcontext()).inflate(r.layout.cardlayout, parent, false);     return new viewholder(itemview); }  @override public void onbindviewholder(viewholder holder, int position) {      holder.title.settext(my_data.get(position).gettitle());      if (my_data.get(position).getimageurl() != null || !my_data.get(position).getimageurl().equalsignorecase("")) {         glide.with(context).load(my_data.get(position).getimageurl()).into(holder.imageview);     } else {         glide.with(context).load(r.drawable.imageback).into(holder.imageview);//load(my_data.get(position).getimageurl()).into(holder.imageview);         //holder.imageview.setimagedrawable();     } }  @override public int getitemcount() {     return my_data.size(); }  public class viewholder extends recyclerview.viewholder implements view.oncreatecontextmenulistener, view.onclicklistener,         menuitem.onmenuitemclicklistener{      public imageview imageview;     public textview title;      public viewholder(view itemview) {         super(itemview);         imageview = (imageview) itemview.findviewbyid(r.id.image1);         title = (textview) itemview.findviewbyid(r.id.title1);          itemview.setonclicklistener(this);         itemview.setoncreatecontextmenulistener(this);      }      @override     public boolean onmenuitemclick(menuitem item) {         if(item.gettitle() == "save"){             toast.maketext(context, "item saved", toast.length_short).show();         }         else if(item.gettitle()=="share"){             toast.maketext(context, "item shared", toast.length_short).show();         }         return true;     }      @override     public void onclick(view v) {          intent intent = new intent(context, displaynewsactivity.class);         string messageurl = my_data.get(getadapterposition()).geturl();         intent.putextra(extra_message, messageurl);         context.startactivity(intent);      }      @override     public void oncreatecontextmenu(contextmenu menu, view v, contextmenu.contextmenuinfo menuinfo) {         menu.setheadertitle("select action");         menu.add("save");         menu.add("share");     }  } 

card layout file:

<?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.cardview android:id="@+id/card_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_margin="4dp" android:orientation="vertical" card_view:cardelevation="7dp" card_view:cardcornerradius="10dp" card_view:cardbackgroundcolor="@color/coloraccent" xmlns:android="http://schemas.android.com/apk/res/android" card_view:theme="@style/apptheme.appbaroverlay" xmlns:card_view="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools">    <linearlayout     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:orientation="vertical">      <imageview         android:id="@+id/image1"         android:layout_width="match_parent"         android:layout_height="90dp"         android:scaletype="centercrop" />      <textview         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:id="@+id/title1"         android:layout_below="@+id/image1"         android:textstyle="bold"         android:paddingleft="5dp"         android:paddingright="5dp"         android:paddingtop="5dp"         android:paddingbottom="5dp"         android:text="title section"         android:textcolor="#ffff"         android:textsize="13sp"/>   </linearlayout>   </android.support.v7.widget.cardview> 

you need connect menu items corresponding menu item click listener, so:

@override         public void oncreatecontextmenu(contextmenu menu, view v, contextmenu.contextmenuinfo menuinfo) {             menu.setheadertitle("select action");             menu.add("save").setonmenuitemclicklistener(this);             menu.add("share").setonmenuitemclicklistener(this);         } 

or add oncontextitemselected() method in activity , put code onmenuitemclick() there.

what opengl message, it's related glide image loading. try listen image errors.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -