Urgenthomework logo
UrgentHomeWork
Live chat

Loading..

ICT311 Mobile App Development: Understand About MVC Pattern

  84 Download     📄   6 Pages / 1424 Words

Case Study: Trip Logger

A startup company plans to develop an app which allows users to keep records of their personal trips. The requirements for the app are listed as follows:

  1. When a user opens the app, the main user interface appears, which includes the following items:
  1. A list of past trips is shown. For each trip item, its title, date, and destination are displayed.
  2. Two buttons are displayed at the top of the screen: Log and Settings.
  3. When the user clicks the button “Log” in the main UI, a new UI appears to allow the user to log a new trip. The following items should be displayed:
  1. Title, Date, Trip Type, Destination, Duration, Comment, Photo. Trip Type should be confined to the categories of Work/Personal/Commute.
  1. The photo item allows the user to take a picture with the camera.
  2. The current GPS location is inserted into an un-editable field automatically.
  3. A button to save this record, and a button to cancel. Either button will bring the app to the refreshed main UI.
  4. The change should also be saved when a user leaves this UI.
  5. When the user clicks a trip item, its details will be displayed in a new UI. The following items should be displayed:

  1. Title, Date, Trip Type, Destination, Duration, Comment, Photo.
  2. The change should be saved when a user leaves this UI, and the main UI should be refreshed to show the change.
  1. A button to delete this record. Deletion should bring the app to the refreshed main UI.
  2. A button to show the saved GPS location in Google Map (in a new window).
  3. When the user clicks the button “Settings” in the main UI, a new UI appears to set up the user profile. The following items should be displayed:
  1. Name, ID, email, gender, comment.
  2. All setting modifications should be saved automatically.
  3. Put dummy values in these fields.

General implementation requirements:

  • Requirement 2 & 3 can be implemented in one Activity.
  • Use fragments for UI. Failure to do so will cause a penalty of 4 marks for each Activity.
  • Save data with SQLite for both trips and settings. Failure to do so will cause a penalty

You also need to prepare a report to explain your design of the app. The following contents are required:

  1. MVC diagrams for each UI. There should be 3 MVC diagrams for 3 key Activities. The diagram for Google Map Activity is not required.
  1. Database schema design. There should be at least two tables, one for trips, and one for Settings.
  1. A final section of 'Reflections'. In this part, discuss any difficulties you had implementing the program and how you solved those difficulties. Reflect on how the development process went for you, what you learnt, and what you might do differently next time.

Answer:

  1. Understand About MVC Pattern

MVC Stands For Model View and Controller. Each terminology is used for specific reason. There are many other pattern available like MVVM(Model View ViewModel), MVP(Model View Presenter). Where MVC is standard approach and easy to implement it.

Model :  You can store your data creating model is best use for encapsulate your data from out of the world. You can access property of class through getter and setter method.

View :  What you can see on the screen of mobile device through the view. View is given user experience. You can put text, image, button and many more things on View as per your requirement.

Controller : Controller is responsible for  to play intermediate role between Model and View. Controller will take request from user and call network call if necessary or fetching data from DB and put it in to Model and serve this model to View. Where view can show data which user has requested.

  1. Explanation MVC Using Activity

In our Trip Logger Application we have used 3 Activity which is based on MVC pattern.MainActivity, SettingsActivity and MapActivity all there are associate with MVC pattern.

MainActivity :  Fetching data from Trip Logger DB showing all Trip data which you had enter in past. To achieve MVC pattern, create Model and controller. Model is POJO(Plain Old Java Object) class where you can put getter and setter method. And fetching data from trip table.

Setting Activity : Setting Activity store the person’s data. His person detail can be saved in this activity. It will fetch automatically once he/she added data in DB. Setting data doesn’t have any button to save data in DB just back from the screen it will saved automatically.

Map Activity :  Map Activity show Map on the screen. Showing user’s trip location on the map using latitude and longitude point of location.These location would be added when user add his trip data. Location will be added in database automatically. After successfully adding data into database user will redirect to map screen from detail page of trip detail page and click over the button called location.

  1. Database Schema and its Explanation

There are two table require for this application which are as follow.

  • Trip data Table
  • Person detail Table

Trip Data table have following column to be declare.

  • ID (Primary Key, Long)
  • Title (String)
  • Type (String)
  • Date (String)
  • Destination (String)
  • Comment (String)
  • Image (String) // Path store in string variable for future reference.
  • Latitude (String)
  • Longitude (String)

Person Detail table have following column to de declare.

  • ID (Primary Key, Long)
  • Name (String)
  • Email ID (String)
  • Gender (String)
  • Comment (String)
  1. Challenging task to complete application

There are some challenging task which i called hurdle to develop the application. Every application which is build for mobile have faced so many challenges because you need to achieve so many things in such small memory and storage.

Map Implementation : One of the toughest challenge is to implement map on the mobile device. I need to create google developer console account and get the api key to run map successfully on mobile. Also add google play service library which you provide map api to implement. Also fetch current location for that. To achieve map implementation.

Taking picture from camera : This is easy task but you need manage so many thing to complete this task because you need it’s url for future reference to show images. You have provide permission for that to open camera. Right now there is run time permission for android device.

Reflection

Like trip logger application we do care lot of thing and plan before to start the application. You may need to create document and wireframe. After that you have to create flow chart diagram so you know what happen when you click on button. After that you start design for the application.

There are so many software and tool available for design the application and create prototype for you client. Such as Marvel app, Invision would help to create prototype and click event application for you client.

Hurdles during develop the application:

There are so many hurdel spawn at time of development. First how to create Design and manage architecture. Then impletementing fragment and its backstack when you click on the back button. The Fragment is part of the application and it would be difficult to manage backstack from the activity. There are two fragment in the application. When fragment open you should clear previous all the fragment and back to the activity and reload new data without refereshing the content.

Map Integration is the tuffghest part in the application because there are so many thing which you need to care before implement or integration of actual map. First you need to create API Key for the map integration you can create api key through the google account from  their console part. after that you need to add library for map where you can put actual map on the view.You have to create new activity for that and display map on the screen. You require location data like latitude and longitude on the map so you need some permission for that. Once you have latitude and longitude points then you can put pin on the map so user can see where you are.

Managing database and create table for the application. This is not the tricky task but manage unique data is so important in database also save the image url in the table which you have clicked during add the trip data. To capturing images is little bit tricky part in the application because when you click and open the camera the picture which you have clicked must be save on the device and should be display when you open specific trip.

Copyright © 2009-2023 UrgentHomework.com, All right reserved.