Home » Android » android – NotificationCompat.Builder addAction missing?

android – NotificationCompat.Builder addAction missing?

Posted by: admin June 15, 2020 Leave a comment

Questions:

According to the official documentation the NotificationCompat.Builder class should have method addAction, however I am unable to find it (I am getting “The method addAction(int, String, null) is undefined for the type NotificationCompat.Builder”)

Has anyone figured out how to access this method?

How to&Answers:

The missing methods have been added to Android support library r11. To add it to your project you must:

  1. Open the Android SDK Manager. Scroll down and find the
    Extras/Android Support Library Package. Check the revision column,
    if you have anything less then 11 you need to update your SDK first.
    In Eclipse that is done through the menu Help/Check for Updates.

  2. After you install the Android Support Library you must manually copy
    it into your project’s libs folder. The jar is located at:

.

<your android sdk location>/extras/android/support/v13/android-support-v13.jar

Answer:

As with revision 10, the missing methods have been added. See NotificationCompat.Builder documentation.

Answer:

It appears the latest version of the Support Library is revision 9. I extracted the jar file and poked around and it differs significantly with the official documentation (which claims to have been updated 26 Jul 2012 18:49) when it comes to NotificationCompat and its nested classes.