A way of stopping the accelerometer was devised so that the phone didn't continually vibrate.
Method 1.
Use the onDestroy method, code for this is shown below:
protected void onDestroy()//Stops all activity when it is Destroyed
{
super.onDestroy();
// After this is called, your app process is no longer available in DDMS
android.os.Process.killProcess(android.os.Process.myPid());
}
Method 2. - Overwrite Back button to close application when pressed (Android doesnt allow the Home Button to be overwritten) Code for this is shown below:
public boolean onKeyDown(int keyCode, KeyEvent event)
{
if(keyCode==KeyEvent.KEYCODE_BACK)
{
this.finish();
return super.onKeyDown(keyCode, event);
//Overrides the Back Key to quit Activity when it is pressed
}
Chris
No comments:
Post a Comment