My architecture of restful Android project


Currently, Android phone is very common device and it becomes a trend of future. And restful api and Android phone is a good choice for many projects. When I worked on many projects, I got a lot of issues because I put wrong thing to wrong position on code base. After all, I create an architecture for restful Android application.




  • Activities
  • Fragments
  • Holders

Business: Business part has two main goals:

  • Managing network
  • Managing datasource


  • Calling api
  • Uploading image


  • Using ORM library


  • Controller pass callback to Business.
  • Business pass callback to Network.

Example Client creates a new book. This action will be followed steps:

  • Controller calls BookBusiness.createBook() method.
  • BookBusiness.createBook() method will do below steps:
    • BookNetwork.creteBook()
    • If server creates book fail, BookNetwork will call onNetworkFailure() andBookBusiness will call onCreateBookFailure() to showing error on activity.
    • If server creates book successfully, BookNetwork will call onNetworkSuccess() andBookBusiness call BookDatasource.createBook(). AfterBookDatasource.createBook() creates book on database, returning book (new book variable) to controller.


  • Move Network logic outside of Controller's code
  • Network logic will be isolated.
  • All logic will be belonged to Business layer
  • Controller will be thin. Controller has only goals:
    • Binding component views (2-way binding)
    • Dispatching UI actions
  • Controller can be later changed to MVVM easier.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s