Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help on Java Write the following phone app. The goal is use material design and widgets. As well as refresh everyone on github and

Need help on Java

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Write the following phone app. The goal is use material design and widgets. As well as refresh everyone on github and Android Studio. PROGRAM REQUIREMENTS: You are to write an app that displays information from the model (data) code. You are required to use a support draw layout with the continents listed via a Navigation View widget. As you select the different continent, then the main display will show a list of countries for the selected continent. You will also use the FAB to add a new country to the continent that is currently showing. If you the user clicks on the country name, then is will show a Toast or Snackbar with the country name. In the main display, you must use a RecyclerView (you can embed it in default fragments if you want to). I would suggest using a cardview with recyclerview, if you haven't used it before, but it is not required. c. How to run the program. d. Which phone/emulator to run on including special information like android version (ie v4.4) and screen size. Or if you are using the borrowed a phone: pixel 2, etc. import java.util.ArrayList; import java.util.Arrays; import java.util.List; ** * Created by Jim Ward for Cosc 4735 program 1 public class CountryData { ArrayList Continents; List> listsoflist; * constructor to create the initial data. CountryData() { Continents = new ArrayList(Arrays.asList("africa", "asia", "europe", "north america", "oceania", "south america", "Antarctica" ); listsoflist = new ArrayList>(); //africa 0 listsoflist.add(new ArrayList(Arrays.aslist "Algeria", "Angola", "Benin", "Botswana", "Burkina", "Burundi", "Cameroon", "Cape Verde", "Central African Republic", "Chad", "Comoros", "Congo", "Congo, Democratic Republic of", "Djibouti", "Egypt", "Equatorial Guinea", "Eritrea", "Ethiopia", "Gabon", "Gambia", "Ghana", "Guinea", "Guinea-Bissau", "Ivory Coast", "Kenya", "Lesotho", "Liberia", "Libya", "Madagascar", "Malawi", "Mali", "Mauritania", "Mauritius", "Morocco", "Mozambique", "Namibia", "Niger", "Nigeria", "Rwanda", "Sao Tome and Principe", "Senegal", "Seychelles", "Sierra Leone", "Somalia", "South Africa", "South Sudan", "Sudan", "Swaziland", "Tanzania", "Togo", "Tunisia", "Uganda", "Zambia", "Zimbabwe" ))); //"asia" 1 listsoflist.add(new ArrayList(Arrays.asList "Afghanistan", "Bahrain", "Bangladesh", "Bhutan", "Brunei", "Burma (Myanmar)", "Cambodia", "China", "East Timor", "India", "Indonesia", "Iran", "Iraq", "Israel", "Japan", "Jordan", "Kazakhstan", "Korea, North", "Korea, South", "Kuwait", "Kyrgyzstan", "Laos", "Lebanon", "Malaysia", "Maldives", "Mongolia", "Nepal", "Oman", "Pakistan", "Philippines", "Qatar", "Russian Federation", "Saudi Arabia", "Singapore", "Sri Lanka", "Syria", "Tajikistan", "Thailand", "Turkey", "Turkmenistan", "United Arab Emirates", "Uzbekistan", "Vietnam", "Yemen" //"europe" 2 listsoflist.add(new ArrayList(Arrays.asList "Albania", "Andorra", "Armenia", "Austria", "Azerbaijan", "Belarus", "Belgium", "Bosnia and Herzegovina", "Bulgaria", "Croatia", "Cyprus", "Czech Republic", "Denmark", "Estonia", "Finland", "France", "Georgia", "Germany", "Greece", "Hungary", "Iceland", "Ireland", "Italy", "Latvia", "Liechtenstein", "Lithuania", "Luxembourg", "Macedonia", "Malta", "Moldova", "Monaco", "Montenegro", "Netherlands", "Norway", "Poland", "Portugal", "Romania", "San Marino", "Serbia", "Slovakia", "Slovenia", "Spain", "Sweden", "Switzerland", "Ukraine", "United Kingdom", "Vatican City" )); //"north america" 3 listsoflist.add(new ArrayList(Arrays.asList "Antigua and Barbuda", "Bahamas", "Barbados", "Belize", "Canada", "Costa Rica", "Cuba", "Dominica", "Dominican Republic", "El Salvador", "Grenada", "Guatemala", "Haiti", "Honduras", "Jamaica", "Mexico", "Nicaragua", "Panama", "Saint Kitts and Nevis", "Saint Lucia", "Saint Vincent and the Grenadines", "Trinidad and Tobago", "United States" >)); //oceania" 4 listsoflist.add(new ArrayList(Arrays.asList "Australia", "Fiji", "Kiribati", "Marshall Islands", "Micronesia", "Nauru", "New Zealand", "Palau", "Papua New Guinea", "Samoa", "Solomon Islands", "Tonga", "Tuvalu", "Vanuatu" 1/"south america" 5 listsoflist.add(new ArrayList (Arrays.aslist "Argentina", "Bolivia", "Brazil", "Chile", "Colombia", "Ecuador", "Guyana", "Paraguay", "Peru", "Suriname", "Uruguay", "Venezuela" >)); //"Antarctica" 6 listsoflist.add(new ArrayList()); * Simple method to add data to a list * The param are item and int list * Which is say a "country" and then integer that is the correct Continent. public boolean add (String item, int list) { if (list >= 0 && list getlist(int list) { if (list >=0 && list Continents; List> listsoflist; * constructor to create the initial data. CountryData() { Continents = new ArrayList(Arrays.asList("africa", "asia", "europe", "north america", "oceania", "south america", "Antarctica" ); listsoflist = new ArrayList>(); //africa 0 listsoflist.add(new ArrayList(Arrays.aslist "Algeria", "Angola", "Benin", "Botswana", "Burkina", "Burundi", "Cameroon", "Cape Verde", "Central African Republic", "Chad", "Comoros", "Congo", "Congo, Democratic Republic of", "Djibouti", "Egypt", "Equatorial Guinea", "Eritrea", "Ethiopia", "Gabon", "Gambia", "Ghana", "Guinea", "Guinea-Bissau", "Ivory Coast", "Kenya", "Lesotho", "Liberia", "Libya", "Madagascar", "Malawi", "Mali", "Mauritania", "Mauritius", "Morocco", "Mozambique", "Namibia", "Niger", "Nigeria", "Rwanda", "Sao Tome and Principe", "Senegal", "Seychelles", "Sierra Leone", "Somalia", "South Africa", "South Sudan", "Sudan", "Swaziland", "Tanzania", "Togo", "Tunisia", "Uganda", "Zambia", "Zimbabwe" ))); //"asia" 1 listsoflist.add(new ArrayList(Arrays.asList "Afghanistan", "Bahrain", "Bangladesh", "Bhutan", "Brunei", "Burma (Myanmar)", "Cambodia", "China", "East Timor", "India", "Indonesia", "Iran", "Iraq", "Israel", "Japan", "Jordan", "Kazakhstan", "Korea, North", "Korea, South", "Kuwait", "Kyrgyzstan", "Laos", "Lebanon", "Malaysia", "Maldives", "Mongolia", "Nepal", "Oman", "Pakistan", "Philippines", "Qatar", "Russian Federation", "Saudi Arabia", "Singapore", "Sri Lanka", "Syria", "Tajikistan", "Thailand", "Turkey", "Turkmenistan", "United Arab Emirates", "Uzbekistan", "Vietnam", "Yemen" //"europe" 2 listsoflist.add(new ArrayList(Arrays.asList "Albania", "Andorra", "Armenia", "Austria", "Azerbaijan", "Belarus", "Belgium", "Bosnia and Herzegovina", "Bulgaria", "Croatia", "Cyprus", "Czech Republic", "Denmark", "Estonia", "Finland", "France", "Georgia", "Germany", "Greece", "Hungary", "Iceland", "Ireland", "Italy", "Latvia", "Liechtenstein", "Lithuania", "Luxembourg", "Macedonia", "Malta", "Moldova", "Monaco", "Montenegro", "Netherlands", "Norway", "Poland", "Portugal", "Romania", "San Marino", "Serbia", "Slovakia", "Slovenia", "Spain", "Sweden", "Switzerland", "Ukraine", "United Kingdom", "Vatican City" )); //"north america" 3 listsoflist.add(new ArrayList(Arrays.asList "Antigua and Barbuda", "Bahamas", "Barbados", "Belize", "Canada", "Costa Rica", "Cuba", "Dominica", "Dominican Republic", "El Salvador", "Grenada", "Guatemala", "Haiti", "Honduras", "Jamaica", "Mexico", "Nicaragua", "Panama", "Saint Kitts and Nevis", "Saint Lucia", "Saint Vincent and the Grenadines", "Trinidad and Tobago", "United States" >)); //oceania" 4 listsoflist.add(new ArrayList(Arrays.asList "Australia", "Fiji", "Kiribati", "Marshall Islands", "Micronesia", "Nauru", "New Zealand", "Palau", "Papua New Guinea", "Samoa", "Solomon Islands", "Tonga", "Tuvalu", "Vanuatu" 1/"south america" 5 listsoflist.add(new ArrayList (Arrays.aslist "Argentina", "Bolivia", "Brazil", "Chile", "Colombia", "Ecuador", "Guyana", "Paraguay", "Peru", "Suriname", "Uruguay", "Venezuela" >)); //"Antarctica" 6 listsoflist.add(new ArrayList()); * Simple method to add data to a list * The param are item and int list * Which is say a "country" and then integer that is the correct Continent. public boolean add (String item, int list) { if (list >= 0 && list getlist(int list) { if (list >=0 && list

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions