Is there any way to handle these cases using activity life cycle.

On Wed, Nov 23, 2011 at 2:31 PM, NaveenShrivastva
<[email protected]> wrote:
> Please give me guideline how to handle the home event and pause event
> in code separately.
>
> On Wed, Nov 23, 2011 at 2:03 PM, skink <[email protected]> wrote:
>>
>>
>> On Nov 23, 9:00 am, Naveen <[email protected]> wrote:
>>> How to handle Home and Back key of a device.
>>>
>>> down vote favorite
>>> 3
>>> share [fb] share [tw]
>>>
>>> So I have this method in one of my Android Activities:
>>>
>>> @Override
>>> public boolean onKeyDown(int keyCode, KeyEvent event)
>>> {
>>>     if(keyCode == KeyEvent.KEYCODE_BACK)
>>>     {
>>>         Log.d("Test", "Back button pressed!");
>>>     }
>>>     else if(keyCode == KeyEvent.KEYCODE_HOME)
>>>     {
>>>         Log.d("Test", "Home button pressed!");
>>>     }
>>>     return super.onKeyDown(keyCode, event);
>>>
>>> }
>>>
>>> Here this code only works with back button but not with home key..
>>>
>>> Please help me , i want seperate functionality on Home key separate
>>> functionality on back key.
>>
>> you cannot handle home key in your app, fortunatelly
>>
>> pskink
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to