-
Notifications
You must be signed in to change notification settings - Fork 89
Expand file tree
/
Copy pathEventEditActivity.java
More file actions
44 lines (36 loc) · 1.25 KB
/
EventEditActivity.java
File metadata and controls
44 lines (36 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package codewithcal.au.calendarappexample;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import java.time.LocalTime;
public class EventEditActivity extends AppCompatActivity
{
private EditText eventNameET;
private TextView eventDateTV, eventTimeTV;
private LocalTime time;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_event_edit);
initWidgets();
time = LocalTime.now();
eventDateTV.setText("Date: " + CalendarUtils.formattedDate(CalendarUtils.selectedDate));
eventTimeTV.setText("Time: " + CalendarUtils.formattedTime(time));
}
private void initWidgets()
{
eventNameET = findViewById(R.id.eventNameET);
eventDateTV = findViewById(R.id.eventDateTV);
eventTimeTV = findViewById(R.id.eventTimeTV);
}
public void saveEventAction(View view)
{
String eventName = eventNameET.getText().toString();
Event newEvent = new Event(eventName, CalendarUtils.selectedDate, time);
Event.eventsList.add(newEvent);
finish();
}
}