Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 292

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report