Giter VIP home page Giter VIP logo

android_inheritance_shopping's Introduction

Android Inheritance Shopping

Instructions

For this project you'll use inheritance to store multiple different classes and objects in the same data structure and display them in a single recyclerview.

For this assignment you are welcome to use the Master Detail Flow activity to start with. It will take a bit to work out where all the code is, but it will save a lot of boilerplate code.

Requirements

  1. Build a parent class called ShoppingItem
  2. Give the class at least the following attributes an int for a color id and a String for the product name

Each class will have a unique color value for the color id int field, this will be used to visually distinguish each different class in your recyclerview The class's constructor should be protected

  1. Write a method for the class called getDisplayName which will return a String in this case, just the product name

Subclasses will override this method and put their own spin on this method

  1. Write at least 3 subclasses for this class. These should be different categories of items you'd purchase, like grocery items, clothing, etc... Each of the classes should have a constant value for the color resource id. In the class constructor, pass this constant up to the super constructor. These should all contain at least one unique data member
  2. Override the getDisplayName method to make a unique twist on the display name ie size of the clothing item, or whether or not the grocery item must be refrigerated
  3. Write a method in your main activity to generate test values and add them to a List
  4. Build a RecyclerView to display the items in the new list.

Set the background color of each item in the view to the color id stored in the object

android_inheritance_shopping's People

Contributors

chancepayne avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.