Add another empty activity called AssignmentDetailsActivity.In onCreate set an onClickListener for the button to it calls the addModule method.Switch to the corresponding Kotlin file for the activity, and add an empty function called addModule.Set the text view to the full with of the activity (Again with an 8dp margin).Set the text size for each of the edit text elements to 18sp, and set them to the full width of the activity (with a 8dp margin all round).An EditText with the id of 'etTitle', and the hint as "Module Name" (again make it a String resource).CO5225" (convert the String to a String resource) An EditText with the id of 'etCode', and the hint as "Module Code e.g.The layout for this should consist of the following elements, one below each other in the following order: Setup view binding, again naming the binding binding.This will be used to add and edit the details relating to an individual module Add a new empty activity named ModuleDetailActivity.Open the associated xml file and add a ListView so it fills the screen (set width and height to match_parent).Setup a view binding named binding for this in the usual way, note that the binding class will be called ActivityModuleListBinding. This will be used to display a list of modules which a used can select to edit Add a new empty activity named ModuleListActivity.In the onCreate method set an onclickListener for the button which calles the addAssignment methodĬreating the additional Activities Module List.Open MainActivity.kt and add an empty stub for the addAssignment method as follows:. If you are struggling with the layout, you can see an example here (click to expand>.Set the id of the ListView to "listView".Open the activity_main_xml and delete the existing TextViewĪdd a ListView which fills most of the screen, with a button at the bottom, as shown here:.Start by creating a new Android App named 'Deadlines' with Kotlin support, targeting API 14 and later, with an Empty Activity (leaving it with the default name).One module can have multiple assignments. The first of these will represent modules (simply a module code and a name), and the second will represent assignments which will comprise of a title, weight, deadline, module and id.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |