Demo entry 6641948

xx

   

Submitted by anonymous on Sep 21, 2017 at 17:14
Language: Java. Code size: 1.3 kB.

addBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (id.length() != 0 && kind.length() != 0 && price.length() != 0 && comment.length() != 0) {.
                    int getid = Integer.parseInt(id.getText().toString());
                    String getKind  = kind.getText().toString();
                    String getPrice  = price.getText().toString();
                    String getComment  = comment.getText().toString();

                    initCalendar();

                    db.execSQL("insert into " + tableName + "(id, periodYear, periodMonth, periodDate, purchaseYear, purchaseMonth, purchaseDate, kind, price, comment) values (" + getid + ", " + periodYear + ", " + periodMonth + ", " + periodDate + ", " + purchaseYear + ", " + purchaseMonth + ", " + purchaseDate + ", '" + getKind+ "', '" +getPrice+ "', '" +getComment + "')");
                    db.close();

                    Toast.makeText(getApplicationContext(), "저장 되었습니다.", Toast.LENGTH_SHORT).show();
                    finish();
                }else{
                    Toast.makeText(getApplicationContext(), "빈칸이 있습니다.", Toast.LENGTH_SHORT).show();
                }
            }
        });

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).