如何将 DatePicker 值转换为字符串?
目前我有一个 TextView 设置, DatePicker 将其值传递给它。它的显示很好。但是,使用该字符串传递给 SQLite 数据库不起作用并返回
android.widget.TextView@41258880
当数据库字段被拉起时。我目前正在获取该值并将其传递给以下 TRY/Catch 语句中的字符串:
case R.id.btnUpdateDB:
boolean worked = true;
try {
String dbWeight = curWeight.getText().toString();
String dbWaist = curWaist.getText().toString();
String dbChest = curChest.getText().toString();
String dbLegs = curLegs.getText().toString();
String dbArms = curArms.getText().toString();
String dbDate = displayDate.toString();
Stats entry = new Stats(MainActivity.this);
entry.open();
entry.createEntry(dbWeight, dbWaist, dbChest, dbLegs, dbArms, dbDate);
entry.close();
break;
我觉得下面这行是不正确的:
String dbDate = displayDate.toString();