我有一个 onclick 事件,例如:
@Override
public void onClick(View createView) {
switch (createView.getId()) {
case R.id.save_button:
break;
}
}
单击按钮时,我希望能够调用:
public void addAppointment(String string) {
// Insert a new record into the Events data source.
// You would do something similar for delete and update.
ContentValues values = new ContentValues();
values.put(TITLE, string);
values.put(TIME, string);
getContentResolver().insert(CONTENT_URI, values);
}
从另一个班级,我是否必须导入某些部分或使其成为静态?