How to write a Java class file corresponding to a new entity in Android Studio? -


i have entity class:

public class item {     private int m_id, m_number, m_price;      public int getid() {         return m_id;     }     public void setid(int id) {         m_id = id;     }     public int getnumber() {         return m_number;     }     public void setnumber(int number) {         m_number = number;     }     public int getprice() {         return m_price;     }     public void setprice(int price) {         m_price = price;     } } 

where should put item.java?

i'm using android studio, , want have proper project package structure. read endpoints, don't know it. can me, please?

sorry bad english, hope understand.

as android developer consultant see lot of different android projects different package structure. while see encouraged put entities in package called entities want why think bad idea. is, instead of having packages named after type/layer

  • entities
  • activities
  • fragments
  • services ..etc

you structure package based on feature instead of type/layer, (taking game example):

  • login
  • highscore
  • achievements
  • core

this way, if refactor login feature of application should ideally see changes in login package instead of changes scattered on different packages (ex: entities/memeber.java, services/loginservice.java, activity/loginactivity.java, fragments/signupfragment.java ...)

another point package names tends redundant common name java files after type (services/loginservice.java, activities/mainactiviy.java)


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -