Problems with the android custom notification bar

Source: Internet
Author: User

Problems with the android custom notification bar

 

First, check the error message:

E/AndroidRuntime (12220): fatal exception: main

E/AndroidRuntime (12220): Process: gn.com. android. update, PID: 12220

E/AndroidRuntime (12220): android. app. remoteServiceException: Bad notification posted from package gn.com. android. update: Couldn't expand RemoteViews for: StatusBarNotification (pkg = gn.com. android. update user = UserHandle {0} id = 1 tag = null score = 0 key = 0 | gn.com. android. update | 1 | null | 10038: Notification (pri = 0 contentView = gn.com. android. update/0x7f03000a vibrate = null sound = null defaults = 0x0 flags = 0x20 color = 0x00000000 vis = PRIVATE ))


E/AndroidRuntime (12220): at android. app. ActivityThread $ H. handleMessage (ActivityThread. java: 1580)

E/AndroidRuntime (12220): at android. OS. Handler. dispatchMessage (Handler. java: 106)


E/AndroidRuntime (12220): at android. OS. Looper. loop (Looper. java: 189)


E/AndroidRuntime (12220): at android. app. ActivityThread. main (ActivityThread. java: 5532)


E/AndroidRuntime (12220): at java. lang. reflect. Method. invoke (Native Method)


E/AndroidRuntime (12220): at java. lang. reflect. Method. invoke (Method. java: 372)


E/AndroidRuntime (12220): at com. android. internal. OS. ZygoteInit $ MethodAndArgsCaller. run (ZygoteInit. java: 950)


E/AndroidRuntime (12220): at com. android. internal. OS. ZygoteInit. main (ZygoteInit. java: 745)

 

 

The Code is as follows:

The notification bar defines a control in the layout as follows:

Android: id = "@ + id/notificationImage"
Android: layout_width = "@ android: dimen/notification_large_icon_width"
Android: layout_height = "@ android: dimen/icationication_large_icon_height"
Android: scaleType = "center"
Android: clickable = "true"
Android: background = "@ * android: drawable/yy_panel_icationication_icon_bg_tile"
Android: src = "@ drawable/stat_sys_download_anim0"
/>

 

The code in java is as follows:

If (null = mNotification ){
MContentIntent = PendingIntent. getActivity (this, 0, new Intent (this, SettingUpdate. class), 0 );
// A new notification object
MNotification = new Notification (R. drawable. stat_sys_download_anim0,
GetString (R. string. policy_auto_update_title), System. currentTimeMillis ());
MNotification. flags = Notification. FLAG_NO_CLEAR;
}
MNotification. icon = R. drawable. stat_sys_download_anim0;

 

Solution:

If you delete the android: src = "@ drawable/stat_sys_download_anim0" sentence, no error is reported, but the error is displayed as black. It was initially estimated that the problem was caused by systemui. I do not know the cause. Please reply to me. Thank you.

 

 

 

 

Related Article

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.