Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8342857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:53:19+00:00 2026-06-09T05:53:19+00:00

For example, I have a class called animals. I don’t think I need to

  • 0

For example, I have a class called animals. I don’t think I need to subclass this into birds, mammals, etc, because I only want to have one class that contains methods and ui for all animals, e.g. show animal being born, show animal growing, show animal being butchered, show animal being eaten (aside: yes, this is just an example but you get the picture). However, I will only want to load all the birds and action them then return to the main menu, then navigate to the mammals and show them, and so on. In my real app each “animal” will have 3x int of information only. There is no video but it will have continuous audio and animation.

Since I only use 1/6 of the animal data each time, ie 10-15 animals, maybe 60-100 animals for the entire app what am I best off doing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T05:53:20+00:00Added an answer on June 9, 2026 at 5:53 am

    Comment turned into answer

    I would create an interface called Animal which contains all the functions.

    public interface Animal {
       public void drawEating();
       public void drawDeath();
    }
    

    Then create classes implementing this interface:

    public class Bird implements Animal {
       public void drawEating() {
           // TODO: fill in
       }
       public void drawDeath() {
          // TODO: fill in
       }
    }
    

    To pass the Animal you want to draw to a new Activity you can pass it in a bundle like described here, or create a function in your new activity called registerAnimal and call that from your first activity.

    public class AnimalActivity extends Activity {
       Animal animal = null;
    
    
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
     }
    
     public void registerAnimal(Animal a) {
          animal = a;
     }
    
     public void someDrawFunction() {
          if (animal != null)
              animal.drawEating();
      }
    

    }

    Using this scheme you only have one activity for all animals, thus saving lots of repetetive code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Example: I have a class called ParentClass. ParentClass has a constructor like this: function
Say I have a class ObjectA (a view controller for example), that does this
So my problem is this. I have a class called Globals that contains all
For example, I have a class called Clothing that inherits from a abstract class
So I have this problem in PHP, I have a class called unit that
Say for example I have a class called Phone. What is the difference between:
I have a class called Test Example and it has one method called dance().
I have a class called AddressCard from an example in Programming in Objective C,
I have a class called Questions . This Questions has properties QuestionID and QuestionAnswer
For example let's say we have a class called Secretary and another class called

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.