How to finish an android application?

前端 未结 9 1301
轻奢々
轻奢々 2020-11-28 06:28

I need to finish an android application. For that i wrote

@Override
public void onBackPressed() {
    AlertDialog.Builder builder = new AlertDialog.Builder(         


        
9条回答
  •  心在旅途
    2020-11-28 07:12

    Please read first this post from Google Android Developer Advocate Reto Meier : When to Include an Exit Button in Android Apps (Hint: Never)

    What is th symptom that make you want to add an exit button ? If you need to clear the activity stack and always restart with a specific Activity, maybe you just have to tweak your activity manifest declaration with attributes like : android:clearTaskOnLaunch

提交回复
热议问题