@SuppressLint("SimpleDateFormat") public void onClick(View v) { // TODO Auto-generated method stub Date theDate = Calendar.getInstance().getTime(); SimpleDateFormat dateFormat = new SimpleDateFormat("MMM dd"); String date = dateFormat.format(theDate); // On list view if (restaurantId == null) { SimpleDateFormat created = new SimpleDateFormat("dd MMM yyyy hh:mm aa"); String createdDate = created.format(theDate); helper.insert( textTitle.getText().toString(), textContent.getText().toString(), date, "Created on " + createdDate.toString()); count++; finish(); } else { if (save.getText().toString() == "edit") { save.setText("save"); textContent.setClickable(true); textContent.setFocusableInTouchMode(true); textTitle.setFocusable(true); textTitle.setClickable(true); textTitle.setFocusableInTouchMode(true); } SimpleDateFormat modified = new SimpleDateFormat("dd MMM yyyy hh:mm aa"); String modifiedDate = modified.format(theDate); helper.update( restaurantId, textTitle.getText().toString(), textContent.getText().toString(), date, "Modified on " + modifiedDate.toString()); Toast.makeText(getApplicationContext(), "saved", Toast.LENGTH_SHORT).show(); } }