jeudi 30 avril 2015

How to compare user input values with arraylist items?

I have one edittext in my app,now I have three values in arraylist [10,15,20],and I want compare this values with user input,...suppose if user enters 9 in edittext it should not go inside if statement..following is my code..with this code issue is if i enter 9 it goes to else part and if i enter 11 then also it goes to else part

    bxqtyy.addTextChangedListener(new TextWatcher() {

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
                // TODO Auto-generated method stub

                for(int k=0;k<allqtys.size();k++)
                {

                    allqtys.get(k);
                    System.out.println("sawsaw"+allqtys);

                if(Integer.parseInt(bxqtyy.getText().toString()) >= allqtys.get(k))
                {

                    //uprice.setText("1470");
                    System.out.println("lets check"+Integer.parseInt(bxqtyy.getText().toString()));
                }
                else
                {
                    //uprice.setText("1500");
                    System.out.println("lets uncheck");
                }
                }
            }

            @Override
            public void beforeTextChanged(CharSequence s, int start, int count,
                    int after) {
            }

            @Override
            public void afterTextChanged(Editable s) {

            }
        });

Aucun commentaire:

Enregistrer un commentaire