我的确定按钮不起作用...运行应用程序时出错。每当我按下确定按钮时,它会强制关闭..在机器人中

时间:2014-12-24 04:56:37

标签: android

下面是我的“确定”按钮的代码...每当我按下我的按钮命名为“确定”....它没有执行任何任务它挂起或给出错误强制关闭...代码是非常的很简单,只要我按下确定按钮就可以显示特定的消息......这是第一次发生..所以不知道如何解决这个错误

      protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      choice=0;
      ok=(Button)findViewById(R.id.button);

      cancel = (Button)findViewById(R.id.button2);
      display=(EditText)findViewById(R.id.text);
      view=(TextView)findViewById(R.id.view);
      view1=(TextView)findViewById(R.id.view1);
        ok.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v){
        name=display.getText().toString();
        choice=Integer.parseInt(name);
            while(choice>=50 && choice<=74)
            {
                if(choice==64||choice==65||choice==67) {
                    view1.setText("Please put the correct input as the Error no:64,65 & 67 does                   not fall under any category of error");
                }
                if(choice==50) {
                    view1.setText("DECLINED ATM AND POS NOT TICKED IN CBS OPTION CH021");
                }
                 if(choice==51) {
                    view1.setText("EXPIRED CARD");
                 }
                 if(choice==52)
                 {
                     view1.setText("INVALID CARD(WRONG 16 DIGIT CARD NUMBER PUNCHED)\\nIN   CMS01/CARD DETAILS NOT FOUND IN SWITCH DATA BASE AND NON PERSONALIZED CARD AUTHORISED AFTER 1 MONTH IN CMS01");
                }
                if((choice>=53&&choice<=63) || choice==68)
                {
                    view.setText("ERROR FALLS UNDER THE NON-TECHNICAL CATEGORY");
                    if(choice==53)
                    {
                    view1.setText("INVALID PIN");
                    }
                    if(choice==54)
                    {view1.setText("DATABASE PROBLEM (PBF NOT RECEIVED FOR THE A/C AND TXN TRIED IN OFF LINE)");

                    }
                    if(choice==55)
                    {
                        view1.setText("INELIGIBLE TRANSACTION (DECLINED FOR OTHER BANK CARD HOLDERS)");
                    }
                    if(choice==56)
                    {
                        view1.setText("INELIGIBLE ACCOUNT (SB A/C LINKED BUT CUSTOMER SELECTING CURRENT A/C IN ATM)");
                    }
                    if(choice==57)
                    {
                        view1.setText("TRANSACTION NOT SUPPORTED (CUSTOMER TRYING FOR CASH DEPOSIT, PRESENTLY NOT AVAILABLE)");
                    }
                    if(choice==58)
                    {
                        view1.setText("INSUFFICIENT FUNDS NO AMOUNT 3/ INSUFFICIENT FUNDS WITH AMOUNT 3");
                    }
                    if(choice==59)
                    {
                        view1.setText("INSUFFICIENT FUNDS NO AMOUNT 3/ INSUFFICIENT FUNDS WITH AMOUNT 3");
                    }
                    if(choice==60)
                    {
                        view1.setText("USES LIMIT EXCEEDED (FOR OTHER BANK CUSTOMERS FORM RESPECTIVE SWITCH)");
                    }
                    if(choice==61)
                    {
                        view1.setText("WITHDRAWAL LIMIT WOULD BE EXCEEDED (25000 ALREADY WITH DRAWN NEXT TRANSACTION TRYING FOR 7000)");

                    }
                    if(choice==62)
                    {
                        view1.setText("PIN TRIES EXCEEDED (ALREADY WRONGLY PUNCHED 3 TIMES)");

                    }
                    if(choice==63)
                    {
                        view1.setText("WITHDRAWAL LIMIT ALREADY REACHED( AFTER WITH DRAWING 25000 IF TRIED IT GIVES ERROR 61 SECOND TIME ONWARDS GIVE 63)");

                    }
                    if(choice==68)
                    {
                        view1.setText("EXTERNAL DECLINE(MEMO IN A/C OR SAME CARD LINKED TO 2 CUST DS OD A/C EXPIRED ETC)");

                    }
                }

                if((choice>=70&&choice<=74)|| choice==66) {
                    view.setText("ERROR FALLS UNDER TECHNICAL CATEGORY");
                 if(choice==70) {
                 view1.setText("SYSTEM ERROR (A/C MISMATCH BETWEEN CBS AND SWITCH)");
                 }
                    if(choice==71) {
                        view1.setText("CONTACT CARD ISSUER (NEW USER USED IN OFFLINE MODE)");
                    }
                    if(choice==72) {
                        view1.setText("DESTINATION NOT AVAILABLE /Mostly for other bank cards");
                    }
                    if(choice==73) {
                        view1.setText("ROUTING LOOK UP PROBLEM /Mostly for other bank cards");
                    }
                    if(choice==74) {
                        view1.setText("MESSAGE EDIT ERROR /ATM NOT READING THE DATA CORRECTLY SINCE MAGNETIC STRIP MAY BE DAMAGED");
                    }
                    if(choice==66) {
                        view1.setText("STATEMENT INFORMATION NOT AVAILABLE ( WHEN CBS IS OFF LINE MINI STATEMENT DOES NOT COME)");
                    }





                }


            }
        }
      });

2 个答案:

答案 0 :(得分:1)

while(choice>=50 && choice<=74)

它是一个无限循环。你想要的是这个:

if(choice>=50 && choice<=74)

请检查。

答案 1 :(得分:0)

这是一个无限循环,选择永远不会改变

while(choice>=50 && choice<=74)