Multiple usage examples of notification for Android

When we are using the mobile phone, if a short message comes and we don't click to view it, is there a small icon prompt of short message in the top status bar of the mobile phone? Do you also want to realize this function? Today's notification solves this problem.

We also know that the Android system is constantly upgrading. There are many ways to use notification. Some methods have been abandoned by Android. Now I have implemented three different methods and adapt to different Android versions. Now I'll publish the code. I like to write the explanation in the code. I won't say more here,

Look at the renderings first:

Look at the code. The main codes are as follows:

Look at the main layout file again:

There is also a custom notification layout file_ Notification.xml with the following code:

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>