Open nguo opened 10 years ago
Looks good Nina! Hope you found this useful as an introduction to native Android development. This project contains a lot of key learnings such as how to use the relative layout system, work with lists of data with adapters and handle events within an app. It also contains basic navigation and passing data back and forth between screens. Let me know if you had any other questions on the project!
Eclipse gave me warnings saying "User a layout_height of 0dip instead of fill_parent for better performance." However, when I change ListView to 0dip it seemingly ignores the weights and pushes out the bottom elements. Am I not using weights correctly? I noticed in the slides that you defined a set dp instead of using weights. Is there a reason you chose one over the other?
Weights only work within a LinearLayout. In a RelativeLayout, you should instead use relative constraints such as "android:layout_below" to construct views. The slides use a dp as a simplifying instruction but in reality it's better to avoid ever setting a height except to "match_parent" or "wrap_content". After we cover this next lecture, if you still have questions happy to chat more!
In order to save back the data from EditItemActivity, ToDoActivity needs to know the pos of the item in the items list. The way I implemented it was to send the pos from ToDoActivity => EditItemActivity, then send it back from EditItemActivity => ToDoActivity. I was wondering if there was a better way of doing this?
There is a simpler way which is to simply keep a local variable in the activity that tracks the position. You could just have a local member variable such as "currentItemPos" and then when an item is clicked, just store the position at that time. Passing it across is certainly a suitable way to do it as well.
My ToDo app is complete. Please review. Thanks.
I have a couple questions:
Hours: 2.5
-- Nina Guo
/cc @nesquena @timothy1ee