对话框无法正常运行

时间:2015-10-06 05:36:27

标签: android

当我在我的应用程序中按下按钮3(下载)时,将出现下载对话框(第一个对话框),如果我按下载框中的下载按钮,应用程序将检查数据是否存在于我的内部数据库中。如果数据存在,应用程序将使用第二个对话框通知用户。然而,第二个对话框没有出现。只有在我重新启动button3之后才出现,更糟糕的是第一个对话框出现在第二个对话框下,使整个事情变得混乱。

 button3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                dbhandler = new mydbhandler(getContext(), null, null, 1);


                if (alertdialog("download", "no thanks")) {
                    if (dbhandler.checkDatabase(movielist1.get(position).getLocation())) {
                        alertdialog1("The map is already in your internal database", "ok", "check it out!");
                    }


                    if (!dbhandler.checkDatabase(movielist1.get(position).getLocation())) {


                        final Calendar cal = Calendar.getInstance();
                        int day = cal.get(Calendar.DAY_OF_MONTH);
                        int month = cal.get(Calendar.MONTH);
                        int year = cal.get(Calendar.YEAR);
                        StringBuffer buffer = new StringBuffer();
                        buffer.append(day + "-" + (month + 1) + "-" + year);
                        String date = DateFormat.getTimeInstance().format(new Date());
                        String b = "Date: " + buffer + "\n" + "Time: " + "" + date + "\n";

                        products products = new products(movielist1.get(position).getLocation(), String.valueOf(movielist1.get(position).getVersion()), b);


                        dbhandler.addProduct(products);




                    }

                }
            }


        });

enter image description here

0 个答案:

没有答案
相关问题