You should take a look at View.OnLongClickListener
, that will do what you want. Like you said, View.OnClickListener
will only be fired when you release your finger.
start.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setTitle(R.string.PickTimingMethod);
builder.setItems(R.array.TimeOptions, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
Toast.makeText(MainActivity.this, i + "", Toast.LENGTH_LONG).show();
}
});
builder.create().show();
return true;
}
});