<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
- <item android:id="@+id/deleteevent" android:icon="@android:drawable/ic_menu_delete" android:title="Delete Event" android:visible="true" android:titleCondensed="DELETE" android:showAsAction="always"></item>
+ <item android:id="@+id/deleteevent"
+ android:icon="@android:drawable/ic_menu_delete"
+ android:title="Delete Event"
+ android:visible="true"
+ android:titleCondensed="DELETE"
+ android:showAsAction="always">
+
+ </item>
<item android:id="@+id/NewEvent" android:title="New event"
android:visible="true" android:showAsAction="ifRoom"
android:icon="@android:drawable/ic_menu_add"
android:titleCondensed="NEW">
+ </item>
+ <item android:id="@+id/edit_event"
+ android:title="@string/edit_event"
+ android:visible="true"
+ android:showAsAction="never">
+
</item>
<item android:id="@+id/eventlist"
android:title="@string/eventlist"
<string name="years">years</string>
<string name="refresh">Refresh</string>
<string name="stop_alarm">Stop Alarm</string>
+ <string name="edit_event">Edit Event</string>
<string-array name="repeat_array_s">
<item>Day</item>
import android.app.DatePickerDialog.OnDateSetListener;
import android.app.Fragment;
import android.app.TimePickerDialog.OnTimeSetListener;
+import android.content.Context;
+import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
public final class AddEventActivity extends Activity implements OnDateSetListener, OnTimeSetListener{
private TextView dateTimeTextView;
private Event tempEvent=new Event();
+ public static final String EXTRA_EVENT = "event";
+
+ public static void editEvent(final Context c, final Event e) {
+ Intent i = new Intent(c,AddEventActivity.class);
+ i.putExtra(AddEventActivity.EXTRA_EVENT,e);
+ c.startActivity(i);
+ }
+
@Override
protected void onCreate(final Bundle savedInstanceState) {
final SimpleDateFormat dayOfWeekFormat = new SimpleDateFormat("EEEEEEE", Locale.UK);
startDay.setText(dayOfWeekFormat.format(start));
- if(dateFormat.format(start)!=dateFormat.format(end)) {
+ if(!dateFormat.format(start).equals(dateFormat.format(end))) {
endDay.setText(dayOfWeekFormat.format(end));
endDate.setText(dateFormat.format(end));
}
final Intent it=new Intent(this,EventListActivity.class);
startActivity(it);
return true;
+ case R.id.edit_event:
+ AddEventActivity.editEvent(DisplayEventActivity.this,event);
+ return true;
default:
return true;
}
return r.toArray(new Event[r.size()]);
}
+ public void insert(final Context context) {
+ final ContentResolver cr=context.getContentResolver();
+ //cr.insert(Uri.withAppendedPath(Events.CONTENT_URI));
+ //cr.notifyChange();
+ }
+
public void delete(final Context context){
final ContentResolver cr=context.getContentResolver();
cr.delete(Uri.withAppendedPath(Events.CONTENT_URI, Long.toString(_id)), null, null);