android


Does Android application development Guideline allow disabling Default Menu and back button for particular application?


In my application there are some buttons that are very near to that device default back button and Menu Button.
Thus I got problem while pressing that My application button which are near to Menu and Back button.
So for that application purpose I want to disable the default back and Menu Button.
So does Android Application development Guideline allow if we want to disable the back and Menu Button during particular application?
If yes then how is it possible?
Thanks.
So is Android Application development Guideline allow if we want to disable the back and Menu Button during perticular application?
The guideline of programming for any OS (Windows, Mac, iOS, Android etc.) is don't break the default behaviour.
A user will expect that your App supports the default behaviour of the device he/she is using and in most cases bought the device for that very reason: He/she enjoys the default behaviour. If he/she wanted another type of user interaction, he/she would have bought another type of device.
In my application there are some buttons that are very near to that device default back button and Menu Button
As long as your button is on the screen, I don't see how it can become a problem. If however it in someway is a problem, a better solution than overriding default behaviour is to move or enlarge your buttons to make it easier for the user to hit them.
If yes then how it is possible?
Yes, it can be done.
To disable the back button, simply override onBackPressed() in whatever Activity the problem occurs and leave the implementaion of it empty:
public void onBackPressed() {
//Do nothing
}
The Menu Button will only be a problem ifyou inflate a menu from your Activity. Standard behaviour is that nothing happens when you hit the Menu Button as long as you don't tell your Activity to do something.
Sometimes you'll want to override the default behaviour, fx if you use views and the user expects onback to navigate between views. Other times something else, it all depends on the application. I'd recommend to consider if you should override default behaviour or not.
Heres another example that can be used for all the buttons:
#Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_BACK) && (isSomething)) {
something();
return true;
}
return super.onKeyDown(keyCode, event);
}

Related Links

Add an image to my SQlite database [duplicate]
facebook login issue with parse on android
GLSurfaceView scrollTo does nothing
capture image on touch without using intent
Multiple choice custom Listview
Implementing Database in libgdx
junit.framework.AssertionFailedError for assertNotNull()
How can I declare map class in android and call it from another activity?
ActionBar is not accessible in eclipse
Notification Bar does cut my views
Redirect to Mobile app from facebook and twitter app
Send a putExtra to an activity
download multiple images from server
crop free hand selected part of image
save the picture from the internet (android image loader)
Offline and Online indoor map with open street map.

Categories

HOME
android
uml
microsoftgraph
scikit-learn
paraview
string
apache-flink
pagination
socket.io
rendering
rds
limit
x264
jax-ws
azure-container-service
nstableheaderview
arangodb
text-mining
package-managers
android-7.0-nougat
poedit
inno-download-plugin
highstock
maze
fractions
firebase-analytics
angular-translate
mockjax
fstream
catch-unit-test
spring-security4
jett
dsx-desktop
android-gridview
hibernate-search
sharding
pdw-file-browser
arduino-ide
getlasterror
swagger-php
filesystemwatcher
portforwarding
softmax
lightning
backbone-collections
skin
gpg-signature
cpu-cache
py2neo
vibrate
django-1.10
structuremap4
cudd
installshield-2010
gogs
android-wake-lock
stream-processing
lua-telegram-bot
nss
kiosk
sklearn-pandas
html-to-pdf
ellucian-scribe
beanstalk
design-principles
user-management
extjs-grid
airbrake
botan
alloy-ui
snackbar
zxspectrum
theos
pseudo-class
punycode
wcm
gii
paste
c++builder-xe5
facebook-timeline
abstract-data-type
chart-director
denied
screen-size
fsevents
google-ajax-api
mtu
svk
eclipse-marketplace
addchild
purepdf
mathematical-notation

Resources

Encrypt Message