java.lang.NumberFormatException:SQLITE DbController中的int:“null”无效

时间:2018-04-12 08:03:32

标签: android sqlite android-studio android-sqlite

我试图更新我的SQLite数据库中的数据但是它在EditQuickin Class中崩溃任何想法或解决方案都会受到欢迎

    (QuickinModel)getIntent().getSerializableExtra(Quickin.QUICKIN_EXTRA);

    db = new DbController(this);


    FloatingActionButton fab = findViewById(R.id.fab);
    FullName = findViewById(R.id.FullNameEdit);
    DgnNumber = findViewById(R.id.DgnEdit);

    Save = findViewById(R.id.btnSave);
    spinStatus = findViewById(R.id.spinner);

    FullName.setText(quickinModel.getFullName());
    DgnNumber.setText(quickinModel.getDgnNumber());

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

            String status = spinStatus.getSelectedItem().toString();

            db.update(Integer.parseInt(quickinModel.getId()), status);

            Toast.makeText(EditQuickin.this, "Updated Successfully", Toast.LENGTH_SHORT).show();
            Intent i = new Intent(getApplicationContext(), Quickin.class);
            startActivity(i);

        }
    });

这是我看到的错误

Process: codes.dgn.dgn, PID: 26567
java.lang.NumberFormatException: Invalid int: "null"

1 个答案:

答案 0 :(得分:0)

似乎问题出在Integer.parseInt(quickinModel.getId())中,检查quickinModel.getId()是否返回值