create account

[Interview Project]: An Android Developer Interview Coding Challenge in MVP by edgar-trem

View this thread on: hive.blogpeakd.comecency.com
· @edgar-trem · (edited)
$133.41
[Interview Project]: An Android Developer Interview Coding Challenge in MVP
Yesterday I got asked to build an Android app from scratch as part of an interview coding challenge. The recruiter asked me to submit the project via GitHub, so I thought I would might as well document it here for anyone interested in the Android developer interview process, and/or anyone looking for tips on their upcoming Interview.

### The Challenge

1. Create a native Android Mobile App with a Side menu and map as home screen. 
2. Take a set of dummy data representing locations on map with latitude and longitude. Show these locations on map when a user opens the app using appropriate marker.
3. Create a button to pin a new location searched on map by a user. 
4. Add this new location to your set of dummy data and it should show up the next time user starts the app. 
5. Use MVP architecture 

### My Approach

The challenge pretty easy, I got it done in a couple of hours. Here's the completed product 
![image](https://raw.githubusercontent.com/edTheGuy00/Parkstash-challenge/master/images/image.png)

**What is MVP?** for those if you that do not know, MVP is basically a design style of writing code. MVP stands for Model View Presenter, and when writing code in MVP, you compartmentalize the code to only perform certain function. 
- Model - consists of all the code that is responsible for fetching and storing data
- View - is all the code the is related to the UI (what you see in the screen)
- Presenter - all the business logic or the brain of the app. 

Here's a pretty diagram of MVP

![mvp](https://cdn-images-1.medium.com/max/1600/1*p2JvbgEir0BusDiiVHMvIA.png)

So here is How it Wrote the app, 
1. We define a Contract, in my case I named it [MainContract](https://github.com/edTheGuy00/Parkstash-challenge/blob/master/app/src/main/java/com/taskail/parkstashproject/MainContract.kt) this is the Glue between the View and the Presenter
2. I created a fragment named [MainFragment](https://github.com/edTheGuy00/Parkstash-challenge/blob/master/app/src/main/java/com/taskail/parkstashproject/MainFragment.kt) this will serve as the view. notice that we have to inherit [MainContract.View](https://github.com/edTheGuy00/Parkstash-challenge/blob/11c8fee77c2ba2c2c262f4e803f7f263249adfc4/app/src/main/java/com/taskail/parkstashproject/MainFragment.kt#L19)
3. [MainActivity](https://github.com/edTheGuy00/Parkstash-challenge/blob/master/app/src/main/java/com/taskail/parkstashproject/MainActivity.kt) will serve as the presenter in this case. Here we need to inherit [MainContract.Presenter](https://github.com/edTheGuy00/Parkstash-challenge/blob/11c8fee77c2ba2c2c262f4e803f7f263249adfc4/app/src/main/java/com/taskail/parkstashproject/MainActivity.kt#L20)
4. Lastly I created the Model as [LocationRepo](https://github.com/edTheGuy00/Parkstash-challenge/blob/master/app/src/main/java/com/taskail/parkstashproject/data/LocationRepo.kt)

The [LocationRepo](https://github.com/edTheGuy00/Parkstash-challenge/blob/master/app/src/main/java/com/taskail/parkstashproject/data/LocationRepo.kt) is actually only in charge of fetching and saving the data into the database. The entire Model aspect of the MVP architecture actually consists of almost all the [data](https://github.com/edTheGuy00/Parkstash-challenge/tree/master/app/src/main/java/com/taskail/parkstashproject/data) directory. In here you will find the creation of the [database](https://github.com/edTheGuy00/Parkstash-challenge/blob/master/app/src/main/java/com/taskail/parkstashproject/data/ParkStashDatabase.kt), the definition of the only [table in the database](https://github.com/edTheGuy00/Parkstash-challenge/blob/master/app/src/main/java/com/taskail/parkstashproject/data/Location.kt) and the [access objects](https://github.com/edTheGuy00/Parkstash-challenge/blob/master/app/src/main/java/com/taskail/parkstashproject/data/LocationDao.kt) for the database. 

Overall this was a pretty fun project to do. 

<br /><hr/><em>Posted on <a href="https://utopian.io/utopian-io/@edgar-trem/interview-project-an-android-developer-interview-coding-challenge-in-mvp">Utopian.io -  Rewarding Open Source Contributors</a></em><hr/>
๐Ÿ‘  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 165 others
properties (23)
authoredgar-trem
permlinkinterview-project-an-android-developer-interview-coding-challenge-in-mvp
categoryutopian-io
json_metadata"{"community":"utopian","app":"utopian/1.0.0","format":"markdown","repository":{"id":129164681,"name":"Parkstash-challenge","full_name":"edTheGuy00/Parkstash-challenge","html_url":"https://github.com/edTheGuy00/Parkstash-challenge","fork":false,"owner":{"login":"edTheGuy00"}},"pullRequests":[],"platform":"github","type":"development","tags":["utopian-io","development","android","coding"],"links":["https://raw.githubusercontent.com/edTheGuy00/Parkstash-challenge/master/images/image.png","https://cdn-images-1.medium.com/max/1600/1*p2JvbgEir0BusDiiVHMvIA.png","https://github.com/edTheGuy00/Parkstash-challenge/blob/master/app/src/main/java/com/taskail/parkstashproject/MainContract.kt","https://github.com/edTheGuy00/Parkstash-challenge/blob/master/app/src/main/java/com/taskail/parkstashproject/MainFragment.kt","https://github.com/edTheGuy00/Parkstash-challenge/blob/11c8fee77c2ba2c2c262f4e803f7f263249adfc4/app/src/main/java/com/taskail/parkstashproject/MainFragment.kt#L19","https://github.com/edTheGuy00/Parkstash-challenge/blob/master/app/src/main/java/com/taskail/parkstashproject/MainActivity.kt","https://github.com/edTheGuy00/Parkstash-challenge/blob/11c8fee77c2ba2c2c262f4e803f7f263249adfc4/app/src/main/java/com/taskail/parkstashproject/MainActivity.kt#L20","https://github.com/edTheGuy00/Parkstash-challenge/blob/master/app/src/main/java/com/taskail/parkstashproject/data/LocationRepo.kt","https://github.com/edTheGuy00/Parkstash-challenge/tree/master/app/src/main/java/com/taskail/parkstashproject/data","https://github.com/edTheGuy00/Parkstash-challenge/blob/master/app/src/main/java/com/taskail/parkstashproject/data/ParkStashDatabase.kt","https://github.com/edTheGuy00/Parkstash-challenge/blob/master/app/src/main/java/com/taskail/parkstashproject/data/Location.kt","https://github.com/edTheGuy00/Parkstash-challenge/blob/master/app/src/main/java/com/taskail/parkstashproject/data/LocationDao.kt"],"image":["https://raw.githubusercontent.com/edTheGuy00/Parkstash-challenge/master/images/image.png","https://cdn-images-1.medium.com/max/1600/1*p2JvbgEir0BusDiiVHMvIA.png"],"moderator":{"account":"codingdefined","time":"2018-04-13T04:39:13.487Z","pending":false,"reviewed":true,"flagged":false},"questions":null,"score":null,"total_influence":null,"staff_pick":null,"config":{"questions":[{"question":"How would you rate the impact of the fixed bugs / new features on the project?","question_id":"dev-1","answers":[{"answer":"Very high - the amount of work is very high.","answer_id":1,"value":20},{"answer":"High - the amount of work is high","answer_id":2,"value":15},{"answer":"Average - the amount of work is average","answer_id":3,"value":10},{"answer":"Low - the amount of work is low.","answer_id":4,"value":5},{"answer":"Very Low - the amount of work is very little.","answer_id":5,"value":0}]},{"question":"How would you rate the quality of the provided code?","question_id":"dev-2","answers":[{"answer":"Very high - the code follows all the best practices and/or is the opposite of trivial.","answer_id":1,"value":20},{"answer":"High - the code follows nearly all the best practices and/or is not trivial at all. ","answer_id":2,"value":15},{"answer":"Average - the code follows most the best practices and/or some parts of it are trivial.","answer_id":3,"value":10},{"answer":"Low - the code doesn't really follow the best practices and/or a lot of it is trivial.","answer_id":4,"value":5},{"answer":"Very low - the code doesn't follow the best practices and is completely trivial.","answer_id":5,"value":0}]},{"question":"How do you rate the target project overall?","question_id":"dev-3","answers":[{"answer":"Very high - the project has a unique value, will (potentially) also be useful to a lot of people and has the potential to keep growing.","answer_id":1,"value":10},{"answer":"High - the project isn't really unique but it is well maintained.","answer_id":2,"value":8},{"answer":"Average - the project is limited or not very well maintained.","answer_id":3,"value":4},{"answer":"Low - quality of the project overall is low.","answer_id":4,"value":2},{"answer":"Very low - quality of the project overall is very low and not well maintained.","answer_id":5,"value":0}]},{"question":"Does the writing style meet the Utopian standard considering formalness, informativeness and clarity of the content?","question_id":"c-1","answers":[{"answer":"It is formal, informative and well written with clear content.","answer_id":1,"value":10},{"answer":"It is informative with clear content but not formal enough.","answer_id":2,"value":5},{"answer":"The contribution could be more informative or contains unrelated information, formality and clarity of the content are good enough.","answer_id":3,"value":4},{"answer":"Not all sections were clear enough but overall holds value for the project.","answer_id":4,"value":2},{"answer":"Not at all.","answer_id":5,"value":0}]},{"question":"Was the provided category template for the editor followed?","question_id":"c-2","answers":[{"answer":"All points of the template were included with additional points as well.","answer_id":1,"value":5},{"answer":"The template was followed without additions.","answer_id":2,"value":4},{"answer":"The template was edited but the points were covered in different way.","answer_id":3,"value":3},{"answer":"Not all points of the template were covered in the contribution but the structure is clear enough.","answer_id":4,"value":3},{"answer":"The template was not followed but the structure is clear enough.","answer_id":5,"value":2},{"answer":"The contents are not clearly structured at all.","answer_id":6,"value":0}]},{"question":"Did the contributor tag other users?","question_id":"c-3","answers":[{"answer":"No other users were tagged by the contributor.","answer_id":1,"value":5},{"answer":"Used tags are reasonable and all tagged people are connected to the project and/or the contribution.","answer_id":2,"value":5},{"answer":"The contribution contains mentions of other users that are not directly related to the contribution but related in other ways.","answer_id":3,"value":2},{"answer":"The contributor misuses tagging of other users.","answer_id":4,"value":0}]},{"question":"Did the contributor ask for upvotes, resteems, follows or witness vote?","question_id":"c-4","answers":[{"answer":"No","answer_id":1,"value":5},{"answer":"Yes, but not in a way that disturbs readability. ","answer_id":2,"value":5},{"answer":"Yes.","answer_id":3,"value":0}]},{"question":"Was a graphical content like images, charts, videos or screenshots included?","question_id":"c-5","answers":[{"answer":"Yes, the graphical content is included and adds more value to the contribution.","answer_id":1,"value":5},{"answer":"No but the contribution works well without graphical content well.","answer_id":2,"value":4},{"answer":"Yes, but most of the graphical contentโ€™s purpose is just for presentational matters.","answer_id":3,"value":3},{"answer":"No relevant or useful graphical content is included in the contribution.","answer_id":4,"value":0}]},{"question":"How would you rate the overall added value?","question_id":"c-6","answers":[{"answer":"Extraordinary value to both the project and the open source community overall.","answer_id":1,"value":20},{"answer":"Significant value to the project or open source community.","answer_id":2,"value":15},{"answer":"Some value to the project or open source community.","answer_id":3,"value":10},{"answer":"Little value to the project or open source community.","answer_id":4,"value":5},{"answer":"No obvious value to project or open source community.","answer_id":5,"value":0}]}]}}"
created2018-04-12 00:28:18
last_update2018-04-13 04:39:12
depth0
children8
last_payout2018-04-19 00:28:18
cashout_time1969-12-31 23:59:59
total_payout_value96.636 HBD
curator_payout_value36.773 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length4,104
author_reputation4,926,579,982,162
root_title"[Interview Project]: An Android Developer Interview Coding Challenge in MVP"
beneficiaries
0.
accountutopian.pay
weight1,500
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id49,580,691
net_rshares33,132,515,159,281
author_curate_reward""
vote details (229)
@codingdefined ·
$0.02
Thank you for your contribution.

----------------------------------------------------------------------
Need help? Write a ticket on https://support.utopian.io.
Chat with us on [Discord](https://discord.gg/uTyJkNm).

**[[utopian-moderator]](https://utopian.io/moderators)**
๐Ÿ‘  
properties (23)
authorcodingdefined
permlinkre-edgar-trem-interview-project-an-android-developer-interview-coding-challenge-in-mvp-20180413t044042374z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"}
created2018-04-13 04:40:42
last_update2018-04-13 04:40:42
depth1
children1
last_payout2018-04-20 04:40:42
cashout_time1969-12-31 23:59:59
total_payout_value0.016 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length274
author_reputation528,928,674,653,623
root_title"[Interview Project]: An Android Developer Interview Coding Challenge in MVP"
beneficiaries
0.
accountutopian.pay
weight1,500
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id49,791,311
net_rshares5,542,460,088
author_curate_reward""
vote details (1)
@edgar-trem ·
Thanks, 

It seems like contributions  can be much more conscience  with the score card, But I would think it's a bit more work for you moderators right? 
properties (22)
authoredgar-trem
permlinkre-codingdefined-re-edgar-trem-interview-project-an-android-developer-interview-coding-challenge-in-mvp-20180414t235501293z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"}
created2018-04-14 23:55:03
last_update2018-04-14 23:55:03
depth2
children0
last_payout2018-04-21 23:55:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length154
author_reputation4,926,579,982,162
root_title"[Interview Project]: An Android Developer Interview Coding Challenge in MVP"
beneficiaries
0.
accountutopian.pay
weight1,500
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id50,106,462
net_rshares0
@mathemandy ·
Was it timed?  I mean the interview
properties (22)
authormathemandy
permlinkre-edgar-trem-interview-project-an-android-developer-interview-coding-challenge-in-mvp-20180412t031447913z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit/0.1"}
created2018-04-12 03:14:57
last_update2018-04-12 03:14:57
depth1
children3
last_payout2018-04-19 03:14:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length35
author_reputation2,560,140,924,580
root_title"[Interview Project]: An Android Developer Interview Coding Challenge in MVP"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id49,598,513
net_rshares0
@edgar-trem ·
They gave me two days to complete it, I did it in about 5 hours.
properties (22)
authoredgar-trem
permlinkre-mathemandy-re-edgar-trem-interview-project-an-android-developer-interview-coding-challenge-in-mvp-20180412t032922602z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit/0.1"}
created2018-04-12 03:29:24
last_update2018-04-12 03:29:24
depth2
children2
last_payout2018-04-19 03:29:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length64
author_reputation4,926,579,982,162
root_title"[Interview Project]: An Android Developer Interview Coding Challenge in MVP"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id49,600,006
net_rshares0
@sweetim ·
lol, thats the boss, You getting the role :) 
whats gonna happen to Mixion ?
๐Ÿ‘  
properties (23)
authorsweetim
permlinkre-edgar-trem-re-mathemandy-re-edgar-trem-interview-project-an-android-developer-interview-coding-challenge-in-mvp-20180412t033148738z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit/0.1"}
created2018-04-12 03:31:57
last_update2018-04-12 03:31:57
depth3
children1
last_payout2018-04-19 03:31:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length76
author_reputation269,250,405,392
root_title"[Interview Project]: An Android Developer Interview Coding Challenge in MVP"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id49,600,287
net_rshares2,231,197,940
author_curate_reward""
vote details (1)
@steemitboard ·
Congratulations @edgar-trem! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

[![](https://steemitimages.com/70x80/http://steemitboard.com/notifications/payout.png)](http://steemitboard.com/@edgar-trem) Award for the total payout received

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click [here](https://steemit.com/@steemitboard)

If you no longer want to receive notifications, reply to this comment with the word `STOP`

> Upvote this notification to help all Steemit users. Learn why [here](https://steemit.com/steemitboard/@steemitboard/http-i-cubeupload-com-7ciqeo-png)!
properties (22)
authorsteemitboard
permlinksteemitboard-notify-edgar-trem-20180414t160127000z
categoryutopian-io
json_metadata{"image":["https://steemitboard.com/img/notifications.png"]}
created2018-04-14 16:01:27
last_update2018-04-14 16:01:27
depth1
children0
last_payout2018-04-21 16:01:27
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length684
author_reputation38,975,615,169,260
root_title"[Interview Project]: An Android Developer Interview Coding Challenge in MVP"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id50,051,088
net_rshares0
@utopian-io ·
### Hey @edgar-trem I am @utopian-io. I have just upvoted you!
#### Achievements
- People loved what you did here. GREAT JOB!
- You have less than 500 followers. Just gave you a gift to help you succeed!
- Seems like you contribute quite often. AMAZING!
#### Utopian Witness!
<a href="https://discord.gg/zTrEMqB">Participate on Discord</a>. Lets GROW TOGETHER!
- <a href="https://v2.steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1">Vote for my Witness</a>
- <a href="https://v2.steemconnect.com/sign/account-witness-proxy?proxy=utopian-io&approve=1">Proxy vote to Utopian Witness</a>

**Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x**
properties (22)
authorutopian-io
permlinkre-edgar-trem-interview-project-an-android-developer-interview-coding-challenge-in-mvp-20180414t120354863z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"}
created2018-04-14 12:03:57
last_update2018-04-14 12:03:57
depth1
children0
last_payout2018-04-21 12:03:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length760
author_reputation152,955,367,999,756
root_title"[Interview Project]: An Android Developer Interview Coding Challenge in MVP"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id50,015,856
net_rshares0