Java 应用程序中模拟时钟小部件的setBitmap不';机器人不能工作

Java 应用程序中模拟时钟小部件的setBitmap不';机器人不能工作,java,android,Java,Android,我要改变应用程序中模拟时钟小部件的背景,出于某些原因,我必须使用位图。 但是这个代码对我不起作用! 有人能帮帮我吗?!非常感谢 Bitmap bitmap = BitmapFactory.decodeFile(FilePathStrings[position]); RemoteViews remoteViews = new RemoteViews(getPackageName(), R.layout.widget_layout); remoteViews.setBitmap(R.id.analo

我要改变应用程序中模拟时钟小部件的背景,出于某些原因,我必须使用位图。 但是这个代码对我不起作用! 有人能帮帮我吗?!非常感谢

Bitmap bitmap = BitmapFactory.decodeFile(FilePathStrings[position]);
RemoteViews remoteViews = new RemoteViews(getPackageName(), R.layout.widget_layout);
remoteViews.setBitmap(R.id.analogClock1,"setImageBitmap" ,bitmap);
ComponentName thisWidget = new ComponentName(MainActivity.this, Widget.class);
AppWidgetManager manager = AppWidgetManager.getInstance(MainActivity.this);
manager.getInstance(MainActivity.this).updateAppWidget(thisWidget, remoteViews);

代码对我不起作用
哪种方式不起作用?崩溃不编译吗?没有设置图像?@VladMatvienko位图没有设置为我的模拟时钟!我为其他视图(如imageview)测试了这段代码,效果很好。问题只针对模拟时钟!在我的小部件上写着“问题加载小部件”,请检查日志。有没有奇怪的信息?有stacktrace吗?@VladMatvienko没有!运行setBitmap方法后,我的logcat不会显示任何特殊日志!这是空的:|并且您100%确定您的位图被正确加载到
位图
,对吗?