onClick

时间:2017-07-06 13:15:08

标签: java android

 public void confirmDelete(final ArrayList<Rec> list,final String d){

            AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
    alertDialogBuilder.setMessage("Are you sure, You wanted to delete "+list.size()+" item(s)?");
    System.out.println("list size " + list.size());
    alertDialogBuilder.setPositiveButton("yes",
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface arg0, int arg1) {
                    VaravuSelavu userDB = new VaravuSelavu(getBaseContext());
                    System.out.println("list size "+ list.size()+ " "+d);
                    if (userDB.deleteIncome(list, d))
                    {
                        re=userDB.displayIncome(dateView.getText().toString());
                        if (re != null) {
                            incomeAdapter = new ListViewAdapter(re, getBaseContext());
                            incomeAdapter.notifyDataSetChanged();
                        }
                    }

我想在deleteIncome方法中传递列表..第一个print语句显示列表的正确大小...但是在onClick方法中,列表大小变为0 ...如何访问onClick里面的ArrayList ?

0 个答案:

没有答案