Reputation: 4250
I am wondering what should be the keyboard shortcut of long press in Android emulator? I have a list of items. I have created a function to delete an item if long press over the item. But I can't test in my emulator. If I press the mouse for long time still it's triggering click event.
Upvotes: 4
Views: 10869
Reputation: 8536
Make sure you remember to add the long-click listener to your button.
Example:
//without lambda
button.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
Toast.makeText(getApplicationContext(), "Button Long Clicked", Toast.LENGTH_SHORT).show();
return true;
}
});
//using lambda
button.setOnLongClickListener(v -> {
Toast.makeText(getApplicationContext(), "Button Long Clicked", Toast.LENGTH_SHORT).show();
return true;
});
Upvotes: 0
Reputation: 4589
Please see your code because long click with mouse is long press/ tap in emulators.
Upvotes: 7