0
I have a simple problem, but I cannot find a specific solution to this problem. Inside my application I have a Recycler View and in it I have two click events: one for simple touch and one for long touch. When I run the long tap it runs, but when I take my finger off the screen the simple tap is triggered too (which shouldn’t happen). I need the simple touch not to be called after the long touch runs.
These are the click events implemented on my Activity:
@Override
public void onClick(Tarefa tarefa) {
startActivity(new Intent(MainActivity.this, EditarTarefaActivity.class));
}
@Override
public void onLongClick(Tarefa tarefa) {
Toast.makeText(this, "on long click funcionando!!!", Toast.LENGTH_SHORT).show();
}
On my Adapter it is being called within the onBindViewholder method:
@Override public void onBindViewHolder(@Nonnull Viewholder Holder, int position) { final Task task = tasks.get(position); Holder.bind(task);
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onClick.onClick(tarefa);
}
});
holder.itemView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
onClick.onLongClick(tarefa);
return false;
}
});
}