I have implemented android Calendar events with reference to this question - How to add calendar events in Android?
Below is the code I have used to add a new event to the Calendar
public void onClick(View v) { // TODO Auto-generated method stub String date = etMyTextB.getText().toString(); String time = "9:00 am"; SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy hh:mm a"); try { Date dt = df.parse(date + " " + time); Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(System.currentTimeMillis()); cal.clear(); cal.setTime(dt); Intent calIntent = new Intent(Intent.ACTION_EDIT); calIntent.setType("vnd.android.cursor.item/event"); calIntent.putExtra("beginTime", cal.getTimeInMillis()); calIntent.putExtra("allDay", true); calIntent.putExtra("endTime", cal.getTimeInMillis()+60*60*1000); calIntent.putExtra("title", "Revenue Licence Renewal Date"); startActivity(calIntent); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); }}I haven't used Content Providers because I need support for Android 2.x.x. My question is how can I Programmitically delete the event which have added using the above code?
ليست هناك تعليقات:
إرسال تعليق