Hey androids and cyborgs, i would like to ask if there is an alternative to the traditional and the normally used onClick() event. I would like to use a something with a long delay before the specific listview-item’s function to execute,
in short, i want a onLONGCLICK() event!
root of the problem, i would like my listview to be scrollable without accidentally clicking an item within the said listview, no immediate pop-ups/dialogs, no annoyances. thanks, I hope you can help me with my endeavors… 😀
thanks, for help…
view.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
Intent intent = new Intent(AddNewImmunizationActivity.this, AddNewImmuDialogActivity.class);
intent.putExtra("requestCode", IMMU_DIALOG_EDIT);
intent.putExtra("listPosition", position);
intent.putExtra("availableVaccines", processAvailableVaccines());
intent.putExtra("vaccine", listItem.getVaccine());
intent.putExtra("year", listItem.getYear());
intent.putExtra("month", listItem.getMonth());
intent.putExtra("day", listItem.getDay());
intent.putExtra("adverseReaction", listItem.getAdverseReaction());
intent.putExtra("doctor", listItem.getDoctor());
startActivityForResult(intent, IMMU_DIALOG_EDIT);
return true;
}
});
Hey! The onLongClick event is there since API Level 1! Read this and this.