Page 250 - MDP2020-1
P. 250

|    인천전자마이스터고등학교  ·············································································································
            244

                    public  void  onBackPressed()  {
                            if  (System.currentTimeMillis()  >  backKeyPressedTime  +  2000)  {
                                    backKeyPressedTime  =  System.currentTimeMillis();
                                    showGuide();

                                    return;
                            }
                            if  (System.currentTimeMillis()  <=  backKeyPressedTime  +  2000)  {
                                    activity.moveTaskToBack(true);

                                    activity.finish();
                                    android.os.Process.killProcess(android.os.Process.myPid());
                                    toast.cancel();
                            }
                    }



                    public  void  showGuide()  {
                            toast  =  Toast.makeText(activity,  "\'뒤로\'버튼을  한번  더  누르시면  종료됩니다.",
            Toast.LENGTH_SHORT);
                            toast.show();

                    }
            }


            <로그인  화면>


            <?xml  version="1.0"  encoding="utf-8"?>

            <LinearLayout  xmlns:android="http://schemas.android.com/apk/res/android"
                    xmlns:app="http://schemas.android.com/apk/res-auto"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:background="#fdded9"

                    android:gravity="center"
                    android:orientation="vertical"
                    android:padding="10dp"  >


                    <LinearLayout

                            android:layout_width="fill_parent"
                            android:layout_height="fill_parent"
                            android:layout_gravity="center"
                            android:orientation="vertical"
                            android:paddingLeft="20dp"

                            android:paddingRight="20dp">
   245   246   247   248   249   250   251   252   253   254   255