Android get System ID (COM.ANDROID.INTERNAL.R)

Source: Internet
Author: User

R.id.icon How to get, this thing actually in COM.ANDROID.INTERNAL.R this inside, but this class we can't access how to do?

Reflection Bai, the reflection of Java is omnipotent ah, anything can get as long as he is in.

[Java]View Plaincopy
    1. Class<?> clazz = Class.forName ("com.android.internal.r$id");
    2. Field field = Clazz.getfield ("icon");
    3. Field.setaccessible (true);
    4. Id_icon = Field.getint (null);

[Java]View Plaincopy
    1. N.setlatesteventinfo (context, title, MSG, contentintent);
    2. N.flags |= Notification.flag_auto_cancel;
    3. if (n.contentview! = null && icon! = null) {
    4. N.contentview.setimageviewbitmap (Internalid.id_icon, icon);
    5. }

Reference: http://blog.csdn.net/z1074971432/article/details/10446715

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.