A) Customized ListView 1. Develop an activity that will view a list of doctors. The activity layout will have: a. Title:

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

A) Customized ListView 1. Develop an activity that will view a list of doctors. The activity layout will have: a. Title:

Post by answerhappygod »

A Customized Listview 1 Develop An Activity That Will View A List Of Doctors The Activity Layout Will Have A Title 1
A Customized Listview 1 Develop An Activity That Will View A List Of Doctors The Activity Layout Will Have A Title 1 (140.2 KiB) Viewed 40 times
A Customized Listview 1 Develop An Activity That Will View A List Of Doctors The Activity Layout Will Have A Title 2
A Customized Listview 1 Develop An Activity That Will View A List Of Doctors The Activity Layout Will Have A Title 2 (266.41 KiB) Viewed 40 times
A Customized Listview 1 Develop An Activity That Will View A List Of Doctors The Activity Layout Will Have A Title 3
A Customized Listview 1 Develop An Activity That Will View A List Of Doctors The Activity Layout Will Have A Title 3 (244.88 KiB) Viewed 40 times
A Customized Listview 1 Develop An Activity That Will View A List Of Doctors The Activity Layout Will Have A Title 4
A Customized Listview 1 Develop An Activity That Will View A List Of Doctors The Activity Layout Will Have A Title 4 (235.96 KiB) Viewed 40 times
A Customized Listview 1 Develop An Activity That Will View A List Of Doctors The Activity Layout Will Have A Title 5
A Customized Listview 1 Develop An Activity That Will View A List Of Doctors The Activity Layout Will Have A Title 5 (274.69 KiB) Viewed 40 times
A) Customized ListView 1. Develop an activity that will view a list of doctors. The activity layout will have: a. Title: List of Doctors (Textview) b. list view element (empty) 2. Define a list of doctors: //place this code in the Activity public List<Doctor> getDoctors!{ // or you can have an array List<Doctor> list =new ArrayListo; list add new Doctor("1", "Salwa Ali", "FemalewaRediatrician")); list.add(new Doctor("2", "Salim Jabir”, "Male", "GP")); list add new Doctor(“3”, “Ali Nasir”, “Male”, “NEURO")); list.add(new Doctor(“4”, “Alia Mohammad", "Female" ORTHO)); list.add(new Doctor("5", "Fatin Jameel”, “Female", "ENT")); return list; } // setting the doctor listview, make sure to have Doctor Adapter class. Public void setDoctorListView({ ListView Iv = (ListView) findViewByld(R.id.LISTVIERN.XML); Doctor Adapter arraxAdapter = new DoctorAdapter(this.getDoctors); lx.setAdapterlarravadapter); lv.setOnltem ClickListenert new AdapterView.Onltem ClickListener() { public void galtem ClickladapterView<?> parent, View w.jat position, long id) { =

//write your code here. }}); //define a doctor class Public class Doctor String id.name.gender specialty: 3. Follow the steps in lecture 7 to develop a list view customized item. Define the layout of the list view item as follows a. Dr. Salim Ali Dr. Salma Qays Specialty: ENT Specialty: Pedia Suggester layout in the res»> layout folder, give this file a name and use it in the adapter. <?xml version="1.0" encoding="utf-8"?> <LinearLaxaut was android="http://schemas.android.com/ark/res/android" androidilayoutawidth="patstearent", androidilayout beicht="watshuearent" endroitinrientation "horizontal <lineaclayout android taveut width="wan sentent" android taveut beight="wan Erntent" androidiarientation="vertical"> <TextView androidiit "@+id/destocarametx android aventawidth="Wran canteot". android aventbeight="Wah sentent" android text-"Dr. Ali Salim" <TextView android ist="@+id/ destaca esx android taventawidth="Warcrateot". android tavent beight="Wah Gartent" android text-"Spesiality: ENT" </Lineaclayout <ImageView android vid"@+id/senderix" android aventabidth="5@dp" android naventu beight="50dp" androidisco "@drawable/male" </Linsaclayout b. Define Doctor Adapter (see lecture 7). c. Develop a listener such that when you click on each list view item, the doctor name and id will be displayed in a Toast. B) Application Menu Steps 1. Create menu_main.xml file in the res>>menu folder 2. Add the following xml in the file

<menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/main menu" > <item android:id="@+id/action settings" android:orderInCategory="100" android:title="Settings" app:show Asaction="never" /> </menu> 3. Create icon image: New >> Vector Assets >> Click on Clip Art and select the icon you want. Edit the name as you like. The icon image will be placed in the drawable resource folder. Task: create icon for help. Asset Studio Configure Vector Asset Asset Type Clip Art Local file (SVG, PSD) helpl Name Clip Art Size: 24 dp X 24 dp ? Color: 100% Opacity: Enable auto mirroring for RTL layout 4. Add a new item to the menu (help): a)Add android:id to the item, b) make the showAsAction attribute = ifroom, c) add the icon (Help) attribute to the item. Make the icon file same as the one created above. 5. In the MainActivity.java file, override the Override the onCreate Options Menu such that you inflate the menu_main.xml file as objects @Override public boolean onCreateOptionsMenu (Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate (R.menu.menu_main, menu); return true; } 6. Add handlers for the menu items: In the same way, add handler for the help item such that you display a toast or dialogue.

Public boolean onartigoshtemSelected Menuitem item) { int id = itengetiteld 0, if (id == Buddhastint settings) { TaastrupakeText(this, "Replace your action", Toast LENGTE SHORT2_show(); return true; ] //add code to handle other menu items. return superonationsten Selected (item); } 7. Run the application and check the menu 8. Add a back button in the application menu as follows: a. In the MainActivity - onCreate method enable the home/menu as follows. get SupportActionkar (2.setRisplax Hove A WEnabled(true); b. Scroll down in the MainActivity class and add a handler in case you want to add extra steps @Override public boolean OnSURROGE Naxigatele) ToastmakeText(this, "Replace your Back handeri..." Toaster LENGTE SHORT).show(); Loswi(tName, "Beratse your Back Handler...."); finish(); return true; 9. Run the application and examine the menu 10. You can nest a menu inside an item to create submenus <?xml version="1.0" encoding="utf-8"?> <menu ....... <item android:id="@+id/file" android:title="@string/file" > <!-- "file" submenu --> <menu> <item android:id="@+id/creates Dex" android title="New File" /> <item android id="@+id/open" andreidintitle="Open" /> </menu> </item> </menu>

11. Add items such that you build the following menu structure: Items on the Bar & the Menu 11:53 6 GradingApp NE19 . Menu 11:54 GradingApp Help About Us Settings File File - Submenu 11:54 GradingApp File New File Open
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply