I want to know how to turn off the cell phone when I press the back button. (at processing android)


#1

I want to know how to turn off the cell phone when I press the back button. (at processing android)

For example, in JAVA (PC)

void keyPressed () {
   if (key == ESC) {
     key = 0; // Empêche d'utiliser la touche ESC
   }
}

The program does not turn off when you press the ESC button as follows.

Is there a way to make sure your smartphone does not turn off when you press Back? (at processing android)


#2

On Android, you can override onBackPressed() to stop the sketch from quitting, but this stopped working when Android mode switched to using fragments because that method is in activity, not fragment. See this issue on GitHub for more information. However, it seems that @Andres implemented a fix just 12 hours ago, so this feature should be available for the next release of Android mode.


#3

@GWAK as @calsign mentioned, the next version of the Android mode (4.0.2) will fix the handling of the back button. This version will be released soon, I will post here when is ready to download.


#4

Thanks~ very…

Nice reply!!


#5

Thanks~ very…

Nice reply!!

nice~!


#6

The new version of the mode (4.0.2) is ready! It should appear in the Contributions Manager soon, you can also download it manually from the releases page on GitHub.