summaryrefslogtreecommitdiffstats
path: root/Android/05-UserInterface/UILab/src/course/labs/todomanager/ToDoManagerActivity.java
diff options
context:
space:
mode:
Diffstat (limited to 'Android/05-UserInterface/UILab/src/course/labs/todomanager/ToDoManagerActivity.java')
-rw-r--r--Android/05-UserInterface/UILab/src/course/labs/todomanager/ToDoManagerActivity.java20
1 files changed, 11 insertions, 9 deletions
diff --git a/Android/05-UserInterface/UILab/src/course/labs/todomanager/ToDoManagerActivity.java b/Android/05-UserInterface/UILab/src/course/labs/todomanager/ToDoManagerActivity.java
index fe8d9eb..a911b1d 100644
--- a/Android/05-UserInterface/UILab/src/course/labs/todomanager/ToDoManagerActivity.java
+++ b/Android/05-UserInterface/UILab/src/course/labs/todomanager/ToDoManagerActivity.java
@@ -49,29 +49,31 @@ public class ToDoManagerActivity extends ListActivity {
// Put divider between ToDoItems and FooterView
getListView().setFooterDividersEnabled(true);
- //TODO - Inflate footerView for footer_view.xml file
- TextView footerView = null;
- //TODO - Add footerView to ListView
+ TextView footerView = (TextView) getLayoutInflater().inflate(R.layout.footer_view, null);
+ getListView().addFooterView(footerView);
footerView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
log("Entered footerView.OnClickListener.onClick()");
- //TODO - Attach Listener to FooterView. Implement onClick().
+ Intent intent = new Intent(ToDoManagerActivity.this, AddToDoActivity.class);
+ startActivityForResult(intent, ADD_TODO_ITEM_REQUEST);
}
});
- //TODO - Attach the adapter to this ListActivity's ListView
+ getListView().setAdapter(mAdapter);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
log("Entered onActivityResult()");
- // TODO - Check result code and request code.
- // If user submitted a new ToDoItem
- // Create a new ToDoItem from the data Intent
- // and then add it to the adapter
+ if (requestCode == ADD_TODO_ITEM_REQUEST) {
+ if (resultCode == RESULT_OK) {
+ ToDoItem item = new ToDoItem(data);
+ mAdapter.add(item);
+ }
+ }
}
// Do not modify below here