[android-developers] handling back button
Sir/madam, i am working on an application in which if i click(normal click) on the back button the moveTaskToBackgroud(true) must be called. else if it is a longpress then there id nothing to do. please help regards, karthik -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] handling back button
Sir/madam, i am working on an application in which if i click(normal click) on the back button the moveTaskToBackgroud(true) must be called. else if it is a longpress then there id nothing to do. please help regards, karthik -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] handling back button
Dear Karthik, I would like to recommend you to use the following code snippet in your activity. @Override public boolean onKeyDown(int keyCode, KeyEvent event) { super.onKeyDown(keyCode, event); if (keyCode == KeyEvent.KEYCODE_BACK event.getRepeatCount() = 0) { * //it is for long press * return false; } if (keyCode == KeyEvent.KEYCODE_BACK event.getRepeatCount() == 0) { * //It is for one time press* return true; } return super.onKeyDown(keyCode, event); } Regards Prashant Lal On 24-11-2011 15:44, karthik wrote: Sir/madam, i am working on an application in which if i click(normal click) on the back button the moveTaskToBackgroud(true) must be called. else if it is a longpress then there id nothing to do. please help regards, karthik -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] handling back button
On Thu, Nov 24, 2011 at 5:09 AM, karthik karthik01...@gmail.com wrote: i am working on an application in which if i click(normal click) on the back button the moveTaskToBackgroud(true) must be called. Please do not do this. Please leave the BACK button alone. The user can press HOME to achieve your desired functionality. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training in NYC: http://marakana.com/training/android/ -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] handling back button
On Thu, Nov 24, 2011 at 02:14:21AM -0800, karthik wrote: i am working on an application in which if i click(normal click) on the back button the moveTaskToBackgroud(true) must be called. else if it is a longpress then there id nothing to do. You already got your answer from Mark Murphy...why are you posting this same post again? Later, --jim -- THE SCORE: ME: 2 CANCER: 0 73 DE N5IAL (/4)| There it was, right in the title bar: spooky1...@gmail.com| Microsoft Operations POS. Running FreeBSD 7.0 | ICBM / Hurricane: | Never before has a TLA been so appropriately 30.44406N 86.59909W | mis-parsed. (alt.sysadmin.recovery) Android Apps Listing at http://www.jstrack.org/barcodes.html -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] handling back button
In case of activity life cycle when user pressing the back or home button then onPause method calls by process When i am trying to handle activitySwitchFlag and database on pause then app crash , please help me is any way for block home button for my on activity if no then how to handle separate home and back button. public void onPause(){ super.onPause(); Log.i(TAG, onPause ); try { EncryptVideo(IDValue); } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); } if(activitySwitchFlag) { Log.i(TAG, activity switch); } else{ Log.i(TAG, home button); finish(); // video.pause(); // _HomeDBHANDLING(); } activitySwitchFlag = false; } On Thu, Nov 24, 2011 at 9:13 PM, Jim Graham spooky1...@gmail.com wrote: On Thu, Nov 24, 2011 at 02:14:21AM -0800, karthik wrote: i am working on an application in which if i click(normal click) on the back button the moveTaskToBackgroud(true) must be called. else if it is a longpress then there id nothing to do. You already got your answer from Mark Murphy...why are you posting this same post again? Later, --jim -- THE SCORE: ME: 2 CANCER: 0 73 DE N5IAL (/4) | There it was, right in the title bar: spooky1...@gmail.com | Microsoft Operations POS. Running FreeBSD 7.0 | ICBM / Hurricane: | Never before has a TLA been so appropriately 30.44406N 86.59909W | mis-parsed. (alt.sysadmin.recovery) Android Apps Listing at http://www.jstrack.org/barcodes.html -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Handling back button with Soft keypad
http://developer.android.com/reference/android/view/View.html#onKeyPreIme(int, android.view.KeyEvent) On Fri, Nov 6, 2009 at 10:07 AM, gshetty gshett...@gmail.com wrote: Hi I have a simple edit control in my application and as expected the soft keypad comes up on tapping it. Now what I want to do is that when the user presses the back button, the activity should quit immediately without the soft keypad going down first. On handling the key event in my activity i found that the first 'Back' event is consumed by the keyboard and it does not even reach the activity. However once the soft keypad goes down, the events can be handled in my activity. Is there any way to override this behavior so that the back button first reaches my activity and I can quit immediately. Regards gshetty -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en