java - Identify volume button press and release in android -


in android app want 2 notification separately , when press volume button , release it. using below method can identify volume button press event .

    public boolean onkeydown(int keycode, keyevent event) {            switch (keycode) {             case keyevent.keycode_volume_down:             {                     toast.maketext(getbasecontext(), "volume down button pressed", toast.length_short).show();                   return true;             }             case keyevent.keycode_volume_up:                 toast.maketext(getbasecontext(), "volume button pressed", toast.length_short).show();                  return true;         }         return super.onkeydown(keycode, event);     } 

now want know how can identify volume button release event. if aware please guide me.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -