Get the App
SLTechnology News&Howtos  ›  Development  › 

Android Android how to click the prompt and press the exit again or double-click to exit

Shulou Source: shulou.com Published: 2022-06-03 02:33:04 10月25日 Update

This article mainly shows you "android android how to realize click prompt and then press exit or double-click exit", the content is simple and easy to understand, organized clearly, I hope to help you solve doubts, let Xiaobian lead you to study and learn "android android how to realize click prompt and then press exit or double-click exit" this article bar.

The prompt "Press once more to exit the application" is realized for the first time. If it is pressed again within 1.5 seconds, it will exit. If it exceeds 1.5 seconds, it will prompt again "Press once more to exit the application";

btn.setOnClickListener(new OnClickListener() {@Overridepublic void onClick(View v) {if (count==0) {Toast.makeText(Main.this, "Press again to exit app," Toast.LENGTH_SHORT).show();count=1; t1 = System.currentTimeMillis();}else if (count==1) {t2 = System.currentTimeMillis();if (t2-t1

Tags: Tips apps Android content articles learning help longest time easy to understand more organization knowledge first time editing industry information information channels channels monitoring Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Linux MariaDB OPPO Reno Microsoft