0 Replies - 496 Views - Last Post: 14 April 2019 - 11:01 AM

#1 Steve7419   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 35
  • Joined: 19-November 18

can't proceed to checkout

Posted 14 April 2019 - 11:01 AM

Dear All,


Currently I am trying to have it where, when a checkout is clicked in the option menu in one of my menu cart screen that it adds the item, order qty and total price to the shopping cart screen. (I am a beginner in Java so please bear with me).


here is my code that using inflater:

 private void popUpItem(final Item data) {
        final AlertDialog.Builder alertDialog = new AlertDialog.Builder(MenuActivity.this);

        LayoutInflater inflater = getLayoutInflater();
        View convertView = inflater.inflate(R.layout.item_layout, null);
        ImageView imgItem = (ImageView) convertView.findViewById(R.id.imgItem);
        TextView txtDesc = (TextView) convertView.findViewById(R.id.txtDesc);
        final EditText txtJml = (EditText) convertView.findViewById(R.id.txtJml);

        Glide.with(this).load(data.getLink()).into(imgItem);
        txtDesc.setText(data.getName() + " | VND" + data.getPrice());

        alertDialog.setView(convertView).setTitle("");
        final AlertDialog mAlertDialog = alertDialog.setPositiveButton("ORDER", new DialogInterface.onclickListener() {
            @Override
            public void onclick(DialogInterface dialog, int which) {
                int totalprice = Integer.valueOf(data.getHarga());
                if (!txtJml.getText().toString().equals("") && !txtJml.getText().toString().equals("0")) {
                    totalprice = Integer.valueOf(txtJml.getText().toString()) * Integer.valueOf(data.getHarga());
                }
                setTotal(totalprice);
            }
        }).create();

        mAlertDialog.show();
    }


    private void setTotal(int value) {
        totalPRICE = totalPrice + value;
        txtTotal.setText("Total : VND. " + totalPRICE);
    }




My question is how can I either set a counter or add to a database so that when an item is added to the checkout screen, when the menu window is open it registers that amount?!! Currently, nothing happens when I click the checkout

Please kindly help. Thank you

This post has been edited by Steve7419: 14 April 2019 - 11:02 AM


Is This A Good Question/Topic? 0
  • +

Page 1 of 1