jjzjj

RemoteViews

全部标签

android - 从 RemoteViews 对象中检索文本

我需要从RemoteViews对象中检索一些文本。我有可能获得LayoutId,但我不知道如何从此RemoteView中的TextView检索文本(即通知)。此外,RemoteView只包含setter,但没有getter,所以我想我必须使用LayoutId(以某种方式)。你能帮我吗?谢谢!/edit:我问这个问题的原因是因为我有一个AccessibilityService可以检索通知。因此,这是检索值的唯一方法。/edit2:我使用此代码接收通知:@OverridepublicvoidonAccessibilityEvent(AccessibilityEventevent){if(e

android - RemoteViews问题的setAlpha

我正在制作一个应用程序小部件,小部件上有一个位图,我想更改它的透明度。在我的服务中:RemoteViewsremoteView=newRemoteViews(getApplicationContext().getPackageName(),R.layout.myWidget);remoteView.setInt(R.id.widgetPNG,"setAlpha",50);但它不起作用。模拟器在主屏幕上显示“问题加载小部件”。我很确定其他一切都很好,因为当我更改行以更改它的imageResource它运行完美:remoteView.setInt(R.id.widgetPNG,"setIm

android - 如何正确更新AppWidget?

我是android新手,我在更新应用程序小部件时遇到问题。这是一个新闻小部件,每20秒显示不同的文本。当小部件初始化时,让文本正确切换和显示没有问题。但是,在每30分钟更新一次小部件后,我的widgetIDint数组会保留更新之前存在的int。因此,每次更新后,小部件都会显示旧数据和新数据。在更新过程中是否有清除旧数据的小部件IDint数组。非常感谢任何帮助。我的代码:allWidgetIds2=appWidgetManager.getAppWidgetIds(thisWidget);在小部件中切换文本的方法。这最初工作正常,但更新后显示旧数据和新数据......publicvoidu

安卓权限拒绝 : Bind_RemoteViews Permission

在我的AppWidgetProvider类中从onReceive或onUpdate启动服务时,我不断收到此错误。09-1511:54:04.096:WARN/ActivityManager(1318):PermissionDenial:AccessingserviceComponentInfo{com.fttech.gameIT/com.fttech.StackWidgetService}frompid=1318,uid=1000requiresandroid.permission.BIND_REMOTEVIEWS我已经在我的AndroidManifest中声明了权限。但它仍然给了我这

android - RemoteViews setLayoutParams?

我想将TextView的高度远程设置为WRAP_CONTENT。我该怎么做,因为没有remoteviews.setLayoutParams(viewId,param)函数?我尝试了remoteviews.setInt.(viewId,"setHeight",-2),但这只是将TextView的高度设置为零...谢谢! 最佳答案 当您创建RemoteViews时,将资源ID传递给将TextView设置为高度并设置为wrap_content的构造函数。请记住,当您发送更新时,实际上是在重绘应用小部件,因此您可以使用布局文件来影响您无法通

android - 无法从小部件发送挂起的 Intent ,SendIntentException

我想使用以下代码从我的小部件发送广播:for(inti=0;i但是,我得到这个错误:E/RemoteViews(18176):Cannotsendpendingintent:E/RemoteViews(18176):android.content.IntentSender$SendIntentExceptionE/RemoteViews(18176):atandroid.app.ContextImpl.startIntentSender(ContextImpl.java:640)E/RemoteViews(18176):atandroid.widget.RemoteViews$SetO

java - Android Widget 上的 RemoteViews setViewVisibility

在我的AppWidgetProvider中,我执行以下操作:@OverridepublicvoidonReceive(Contextctx,Intentintent){finalStringaction=intent.getAction();if(action.equals(NEXTPAGE_ACTION)){AppWidgetManagerappWidgetManager=AppWidgetManager.getInstance(ctx);RemoteViewsrv=newRemoteViews(ctx.getPackageName(),R.layout.widget_layout)

android - 无法禁用 android.widget.Button

我在Android小部件中有一个按钮,声明如下:每次我尝试通过RemoteViews启用或禁用此按钮时,我都会收到错误android.widget.RemoteViews$ActionException:view:android.widget.Buttoncan'tusemethodwithRemoteViews:setEnabled(boolean)我的代码:RemoteViewsremoteViews=newRemoteViews(context.getPackageName(),R.layout.widget);remoteViews.setInt(R.id.newWorkBtn

android - FCM - 如何修复 android.app.RemoteServiceException : Bad notification posted from package Couldn't expand RemoteViews for: StatusBarNotification

我看到数千份与通知相关的崩溃报告,但没有可行的方法来调试或检查Firebase云消息传递中通知的应用代码FatalException:android.app.RemoteServiceException:Badnotificationpostedfrompackagecom.appbootup.ipo.news:Couldn'texpandRemoteViewsfor:StatusBarNotification(pkg=com.appbootup.ipo.newsuser=UserHandle{0}id=2tag=IPO-SMEscore=10:Notification(pri=1co

android - 无法展开 : StatusBarNotification 的 RemoteViews

之前有人问过这个问题,但没有一个答案对我有帮助,因此发布了我的案例。我正在尝试使用布局文件构建自定义通知。但是我收到以下错误:android.app.RemoteServiceException:Badnotificationpostedfrompackagecom.eswaraj.app.eswaraj:Couldn'texpandRemoteViewsfor:StatusBarNotification(pkg=com.eswaraj.app.eswarajuser=UserHandle{0}id=8888tag=nullscore=0:Notification(pri=0conte