Skip to content

Instantly share code, notes, and snippets.

View akuholla's full-sized avatar
🎯
Get better

Akshay Holla akuholla

🎯
Get better
  • San Francisco Bay Area
View GitHub Profile
@akuholla
akuholla / gson.txt
Last active May 6, 2022 17:19
Gson
dependencies {
implementation 'com.google.code.gson:gson:2.9.0'
}
val countryArrayType: Type = object : TypeToken<ArrayList<Country?>?>() {}.type
val outputList: ArrayList<Country> = Gson().fromJson(countriesString, countryArrayType)
/*
* Product Requirement: The following file returns a list of countries and a list of countries and capitals. Display the name of the first country on screen.
* Tapping on the country text will display a toast saying "The capital for <country name> is <country capital>"
*
* Things to note:
* + Start by creating a new project on Android Studio. Copy the entire contents of this file to your project.
* + You are not allowed to edit the contents of this file.
* + You are free to choose your path for implementing this solution.
* + You are allowed to look through any documentation and/or use a search engine for reference on syntax.
* + Please think out loud to keep the interviewers engaged in your solution.
/*
* Product Requirement: The function SlowNetwork::getCountries returns a list of countries. Display the name of the first country on screen.
* Tapping on the country will display a toast saying "The capital for <country name> is <country capital>"
*
* Things to note:
* + Start by creating a new project on Android Studio. Copy the entire contents of this file to your project.
* + You are not allowed to edit the contents of this file.
* + You are free to choose your path for implementing this solution.
* + You are allowed to look through any documentation and/or use a search engine for reference on syntax.
* + Please think out loud to keep the interviewers engaged in your solution.
@akuholla
akuholla / SlowNetwork.kt
Last active June 22, 2022 10:50
Class that simulates a network and responds with list of countries
/*
* Product Requirement: The function SlowNetwork::getCountries returns a list of countries. Display the name of the first country on screen.
* Tapping on the country text will display a toast saying "The capital for <country name> is <country capital>"
*
* Things to note:
* + Start by creating a new project on Android Studio. Copy the entire contents of this file to your project.
* + You are not allowed to edit the contents of this file.
* + You are free to choose your path for implementing this solution.
* + You are allowed to look through any documentation and/or use a search engine for reference on syntax.
* + Please think out loud to keep the interviewers engaged in your solution.