It seems to be easy and should look like:
private long DOUBLE_CLICK_DELAY = 150;
private long lastButtonClick = // oldValue
private long currentButtonClick = System.currentTimeMillis();
...
if (currentButtonClick - lastButtonClick < DOUBLE_CLICK_DELAY ) // bla-bla
but I can't save the old value of previuous click in a BroadcastReceiver. Should I save it in a temporary database o something? (No activity used)
public class RemoteControlReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (Intent.ACTION_MEDIA_BUTTON.equals(intent.getAction())) {
if (/* DOUBLE_CLICK */){
Toast.makeText(context, "Tra-la-la!", 100).show();
}
}
}
}