Handle on item long click on recycler view

This has already been answered here. Anyway, you can do it like this: class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener { private Article article; private TextView nameTextView; public ViewHolder(View itemView) { super(itemView); itemView.setOnClickListener(this); itemView.setOnLongClickListener(this); nameTextView = (TextView) itemView.findViewById(R.id.grid_item_article_name_textView); } public void bind(Article article) { this.article = article; nameTextView.setText(article.getName()); } @Override public void onClick(View view) { … Read more

How to properly use setOnLongClickListener() with Kotlin

OnLongClickListener.onLongClick signature required that you return a boolean to notify if you actually consumed the event view.setOnLongClickListener{ Toast.makeText(this, “Long click detected”, Toast.LENGTH_SHORT).show() return@setOnLongClickListener true } or view.setOnLongClickListener{ Toast.makeText(this, “Long click detected”, Toast.LENGTH_SHORT).show() true }

Android: Why does long click also trigger a normal click?

From Event Listeners: onLongClick() – This returns a boolean to indicate whether you have consumed the event and it should not be carried further. That is, return true to indicate that you have handled the event and it should stop here; return false if you have not handled it and/or the event should continue to … Read more

how to implement a long click listener on a listview

You have to set setOnItemLongClickListener() in the ListView: lv.setOnItemLongClickListener(new OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> arg0, View arg1, int pos, long id) { // TODO Auto-generated method stub Log.v(“long clicked”,”pos: ” + pos); return true; } }); The XML for each item in the list (should you use a custom XML) must have android:longClickable=”true” as … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)