remoteview

Android: update specific notification from multiple notifications which have remoteview

岁酱吖の 提交于 2019-12-01 21:16:56
I am creating application that contain notification which have play/pause icon , which. it works perfect when there have just only one notification which have just one notification id, it change play/pause icon through only one notificationid, but there have issue with multiple notification. When there have multiple notification, each notification have play/pause icon. when i click play/pause icon from one of the notification, than it only changing top notification icon from the stack of notification. i know this problem is due to notification-id which it got on click on any notification.I

android.app.RemoteServiceException: Bad notification posted from package. Couldn't expand RemoteViews for: StatusBarNotification

扶醉桌前 提交于 2019-12-01 21:13:44
问题 I have implemented custom notification with RemoteViews widget. I tested it on Android 5.0.2 and Android 6.0. It was working fine. But after sometime, it started crashing everytime it received notification from GCM. Crash Dump - Process: package.name, PID: 27743 android.app.RemoteServiceException: Bad notification posted from package package.name: Couldn't expand RemoteViews for: StatusBarNotification(pkg=package.name user=UserHandle{0} id=1524095391 tag=null key=0|package.name|1524095391

android.app.RemoteServiceException: Bad notification posted from package. Couldn't expand RemoteViews for: StatusBarNotification

我是研究僧i 提交于 2019-12-01 18:48:26
I have implemented custom notification with RemoteViews widget. I tested it on Android 5.0.2 and Android 6.0. It was working fine. But after sometime, it started crashing everytime it received notification from GCM. Crash Dump - Process: package.name, PID: 27743 android.app.RemoteServiceException: Bad notification posted from package package.name: Couldn't expand RemoteViews for: StatusBarNotification(pkg=package.name user=UserHandle{0} id=1524095391 tag=null key=0|package.name|1524095391|null|10247: Notification(pri=0 contentView=package.name/0x7f040033 vibrate=null sound=null defaults=0x0

How to partially update views in an app widget without rebuilding all the RemoteViews

无人久伴 提交于 2019-12-01 18:24:58
I'm implementing an app widget and I'd like to be able to change the property of a single view in the widget layout, without rebuilding all the RemoteViews from scratch, which involves loading XML etc and which is not necessary in some circumstances.. Is there a way to say "update property X on view identified by a specific ID in the current widget layout"? I've seen that there is a partiallyUpdateAppWidget method in the AppWidgetManager class but I can't understand nor if it is meant for this purpose neither how it must be used.. Can you help me or point me to a useful link or example?

How to change the image in app widget programmatically in android

做~自己de王妃 提交于 2019-11-30 09:56:10
I design an android app widget in which two ImageView i want change the image both of the the ImageView when click on the image as well as call a method. Now i use RemoteView like this RemoteViews views1 = new RemoteViews(context.getPackageName(), R.layout.activity_main); views1.setOnClickPendingIntent(R.id.smsImageView, pendIntent1); appWidgetManager.updateAppWidget(appWidgetIds, views1); but i have no idea how i change the image in imageView Thanks. Widget_Layout : <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout

Android notification with RemoteViews - having activity associated with RemoteViews layout

依然范特西╮ 提交于 2019-11-30 09:23:28
I've been researching on how to create custom-layout notification using RemoteView . So far, I am able to create a notification with contentView and bigContentView pointing to a RemoteView with a custom layout xml. However, what does not happen, is to have Activity (associated with custom layout) started when this RemoteView is created. I've double checked and in my layout xml, it appears to have correct Activity class name: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android

How Can I to Change Text Size in RemoteViews

人盡茶涼 提交于 2019-11-30 09:09:38
Under RemoteViewsService.RemoteViewsFactory public RemoteViews getViewAt(int position) { final int itemId = (position % 2 == 0 ? R.layout.light_widget_item : R.layout.dark_widget_item); RemoteViews rv = new RemoteViews(mContext.getPackageName(), itemId); rv.setTextViewText(R.id.widget_item, text); // rv.setTextSize(mPrefs.getTextsize().getValue()); return rv; } How can I change the text size programmatically? How about the setFloat() method? rv.setFloat(R.id.widget_item, "setTextSize", mPrefs.getTextsize().getValue()); 来源: https://stackoverflow.com/questions/6721616/how-can-i-to-change-text

How to change the image in app widget programmatically in android

会有一股神秘感。 提交于 2019-11-29 15:07:57
问题 I design an android app widget in which two ImageView i want change the image both of the the ImageView when click on the image as well as call a method. Now i use RemoteView like this RemoteViews views1 = new RemoteViews(context.getPackageName(), R.layout.activity_main); views1.setOnClickPendingIntent(R.id.smsImageView, pendIntent1); appWidgetManager.updateAppWidget(appWidgetIds, views1); but i have no idea how i change the image in imageView Thanks. 回答1: Widget_Layout : <?xml version="1.0"

Android notification with RemoteViews - having activity associated with RemoteViews layout

荒凉一梦 提交于 2019-11-29 14:14:49
问题 I've been researching on how to create custom-layout notification using RemoteView . So far, I am able to create a notification with contentView and bigContentView pointing to a RemoteView with a custom layout xml. However, what does not happen, is to have Activity (associated with custom layout) started when this RemoteView is created. I've double checked and in my layout xml, it appears to have correct Activity class name: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res

How Can I to Change Text Size in RemoteViews

﹥>﹥吖頭↗ 提交于 2019-11-29 13:56:13
问题 Under RemoteViewsService.RemoteViewsFactory public RemoteViews getViewAt(int position) { final int itemId = (position % 2 == 0 ? R.layout.light_widget_item : R.layout.dark_widget_item); RemoteViews rv = new RemoteViews(mContext.getPackageName(), itemId); rv.setTextViewText(R.id.widget_item, text); // rv.setTextSize(mPrefs.getTextsize().getValue()); return rv; } How can I change the text size programmatically? 回答1: How about the setFloat() method? rv.setFloat(R.id.widget_item, "setTextSize",