I was working with notifications and trying to understand how it works. There are different classes to handle notifications for old APIs like NotificationCompat and Notification(for new APIs). I followed the method invocation of NotificationCompat.build().
The pattern how it worked:
NotificationCompat.Builder.build() ->
NotificaitonCompatIMPL.build() ->
NotificationCompatImplJellyBean.build() ->
NotificationCompatJellybean.Builder() ->
Notification.Builder()
Note that not all of the above methods/constructors are static. They have been written with reference to class name so as to identify the class to which the method belongs.
And then I realized that the old methods are actually calling the new ones. So my question is what is the point of having compat classes if they are calling new methods in their internal implementation.
I know how to make a notification but I need to get some methods inside those classes by overriding methods or using Java reflection so that I can know to which type of class is resId of setSmallIcon converted. Is it drawable or Icon? because I don't have a resID for the drawable, it is made dynamically.