Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

For this assignment you will modify an existing app that tracks business expenses. The existing app is attached in a zip file below. There are two inner classes: ExpenseItem , which defines constants...

1 answer below »

For this assignment you will modify an existing app that tracks business expenses. The existing app is attached in a zip file below. There are two inner classes:ExpenseItem, which defines constants used in mapping the Expense data to the database, andHelper. You should see that theExpenseclass is a simple POJO with properties of amount, description, and expenseDate.

ADAOis an excellent and widely-used design pattern where the code to access a data source is encapsulated within a single class.

  1. Openedu.csuglobal.expenses.data.DAO.java.
  2. Inside the DAO constructor near line 35, add the code to initialize an instance of the database helper class at the location markedTODO.
  3. Locate thequeryExpenses()method and complete the steps markedTODO.
  4. Expandapp | java |edu.csug.expenses(androidTest) | data.
  5. Right-clickDAOTestand select Run 'DAOTest'. If you are offered a choice of two DAOTest options, take the first one, which has the Android symbol next to it. When prompted to choose a device, select the Galaxy-Nexus AVD and click OK.
  6. Click the "4:Run" button at the bottom of the Android Studio window to show the test results.
  7. Openedu.csug.expenses.ExpensesListActivity.java. In the following steps, you may see class names marked as errors due to the required imports not being in the code. The simple solution is to click the class name. When prompted, press AltEnter. Android Studio will add the required import.
  8. Locate theonCreate()method and complete the steps markedTODO.
  9. If it is not already running, start the Galaxy-Nexus AVD. Make sure the app is selected next to the Run button, then run the application by clicking the green run arrow as normal. You should see the list of sample expenses.
  10. At the end of theonCreate()method inExpensesListActivity, add a call toregisterForContextMenu(). Use "mList" as the reference for the View; this should display the context menu.
  11. OverrideonCreateContextMenu()and inflate the menu with an id of R.menu.context_menu. Right-clicking on the file and selectingGenerate | Override Methods... is the easy way to create the new method.
  12. Save and execute the application.
  13. Click and hold on one of the expenses in the list. Your context menu should appear. Of course, there is no associated functionality yet.
  14. Add a new method public intdeleteExpensesById(int id) to theDAO.
  15. Create a where clause, get an instance of a writable database, then call the delete method.
  16. Uncomment theonContextItemSelected()code at the bottom ofExpensesListActivity. Organize imports as needed.
  17. Test your work.

Assignment deliverables (all in a ZIP file):

  1. A screenshot showing the execution of your application.
  2. A DETAILED OVERVIEW OF THE STEPS TAKEN TO COMPLETE YOUR APPLICATION
  3. The project folder containing all source code for your application.

Ensure that your assignment deliverables are attached before submitting your assignment.

Answered Same Day Aug 17, 2021

Solution

Ankit answered on Aug 25 2021
142 Votes
MOD5_CTA (Code And Document)/MOD5_CTA_25_08_2020.ra
MOD5_CTA (Code And Document)/Screenshots/App_After_Delete_Screenshot.PNG
MOD5_CTA (Code And Document)/Screenshots/App_Delete_Screenshot.PNG
MOD5_CTA (Code And Document)/Screenshots/App_Screenshot.PNG
MOD5_CTA (Code And Document)/Screenshots/Test_Screenshot.PNG
MOD5_CTA (Code And Document)/Steps_of_Application.docx
A DETAILED OVERVIEW OF THE STEPS TAKEN TO COMPLETE YOUR APPLICATION
1. Inside the DAO...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here