Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Expert Android Programming

You're reading from   Expert Android Programming Master skills to build enterprise grade Android applications

Arrow left icon
Product type Paperback
Published in Sep 2017
Publisher Packt
ISBN-13 9781786468956
Length 404 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Prajyot Mainkar Prajyot Mainkar
Author Profile Icon Prajyot Mainkar
Prajyot Mainkar
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. Understanding the Gradle System FREE CHAPTER 2. Exploring Android Studio Developer Tools 3. Leap into the Android Support Library 4. Google Play Services 5. Material Design 6. SOLID Android Development and Its Design Principles 7. Understanding MVC, MVP, MVVM and Clean Arch Patterns 8. Decision Making 9. Performance Matters 10. Building Restaurant finder 11. Backend Service 12. App Quality Service 13. Grow Up 14. Testing 15. Preparing for Google Play 16. Understanding App Store Analytics for Optimization

Interface Segregation Principle

The Interface Segregation Principle states that:

No client should be forced to depend on methods it does not use.

According to this principle, if an interface has too many methods, then we need to divide the interface into smaller interfaces with fewer methods. A simple example of this principle is shown next.

Let us assume we are using a custom interface to detect various states of a view:

public interface ClickListener { 
   public void onItemClickListener(View v, int pos); 
   public void onItemLongClickListener(View v, int pos); 
   public void onItemPressListener(View v, int pos); 
   public void onSelectedListener(View v, int pos); 
} 

Now, while implementing this listener, we only want the onItemClickListener or the onItemLongClickListener; the others are not required but we still have to use them in the code. This violates the Interface...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image