ElegantNumberButton值始终为0

时间:2018-02-22 00:11:38

标签: android

我正在尝试获取优雅数字按钮的值,但在插入sqlite数据库时,该值始终为零。这可能是什么问题?

final TextView item_price = view.findViewById(R.id.item_price);
            final ElegantNumberButton numberButton = view.findViewById(R.id.number_button);
            final Button btnAdd = view.findViewById(R.id.btnAdd);

            item_price.setText(price);
            final String number = numberButton.getNumber();

            btnAdd.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    Database database = new Database(getBaseContext());
                    Orders orders = new Orders();
                    orders.setItemId(Integer.parseInt(item_id.toString()));
                    orders.setItemName(name.toString());
                    orders.setPrice(Integer.parseInt(item_price.getText().toString()));
                    orders.setItemQuantity(Integer.parseInt(number));
                    orders.setCustomerName(userInfo.getKeyName());
                    if (database.addToCart(orders)){
                        Intent intent1 = new Intent(FoodDetailsActivity.this, DashboardActivity.class);

                        startActivity(intent1);
                        finish();
                    }


                }
            });

0 个答案:

没有答案