This shows you the differences between two versions of the page.
osp:lectures:lecture-internals [2016/10/16 22:08] vlad.traista [Practical] |
osp:lectures:lecture-internals [2016/11/06 18:47] (current) laura.gheorghe [Lecture] |
||
---|---|---|---|
Line 9: | Line 9: | ||
*{{:osp:lectures:lecture-internals.pdf | Lecture Slides}} | *{{:osp:lectures:lecture-internals.pdf | Lecture Slides}} | ||
+ | *{{:osp:lectures:3.internals_notes.pdf | Lecture Notes}} | ||
{{url>http://ocw.cs.pub.ro/courses/_media/osp/lectures/lecture-internals.pdf}} | {{url>http://ocw.cs.pub.ro/courses/_media/osp/lectures/lecture-internals.pdf}} | ||
Line 22: | Line 23: | ||
{{:osp:media:lab2.zip|}} | {{:osp:media:lab2.zip|}} | ||
- | === Task 1 - Launching an Activity === | + | === Task 1 - Launching an Activity (3p) === |
Create a new project and add a button to the main activity layout. Get a reference to this button in the onCreate method in MainActivity. Add a new Activity to the project. You can automatically add a new activity by right clicking on the project and selecting **New > Activity > Blank Activity** from the menu. This will start a wizard similar to the one at application creation. | Create a new project and add a button to the main activity layout. Get a reference to this button in the onCreate method in MainActivity. Add a new Activity to the project. You can automatically add a new activity by right clicking on the project and selecting **New > Activity > Blank Activity** from the menu. This will start a wizard similar to the one at application creation. | ||
Line 64: | Line 65: | ||
- | === Task 2 - Lists and Adapters === | + | === Task 2 - Lists and Adapters (4p) === |
For this task, you will have to unpack the lab archive and copy the three files into the current project. Copy **MyMenuItem.java** and **MenuAdapter.java** in the same directory where the activity files reside. Copy **list_item.xml** in **res/layout**. | For this task, you will have to unpack the lab archive and copy the three files into the current project. Copy **MyMenuItem.java** and **MenuAdapter.java** in the same directory where the activity files reside. Copy **list_item.xml** in **res/layout**. | ||
Line 99: | Line 100: | ||
</code> | </code> | ||
- | === Task 3 - Data Storage === | + | === Task 3 - Data Storage (3p) === |
We want to provide a method for persistently storing menu items within the application, while also allowing the user to add new ones. For this, modify the behavior of the first EditText (from the first activity) such that its content will not be sent through the intent to the second activity. We will use it for adding the name of a new item. Add other two EditText elements, one for the description and the other one for the price of new items. Also add a new Button, with the "Add" label. When the user clicks it, we want to take the contents of the three EditText elements and add a new item to a database. The second activity will query this database in order to list available items. | We want to provide a method for persistently storing menu items within the application, while also allowing the user to add new ones. For this, modify the behavior of the first EditText (from the first activity) such that its content will not be sent through the intent to the second activity. We will use it for adding the name of a new item. Add other two EditText elements, one for the description and the other one for the price of new items. Also add a new Button, with the "Add" label. When the user clicks it, we want to take the contents of the three EditText elements and add a new item to a database. The second activity will query this database in order to list available items. |