我想设定一个字符串绘制的ID,但它不工作..
所以我试过这个:
String NoteString = "R.drawable.notebackground".toString();
remoteviews.setImageViewResource(R.id.backgroundImage, context.getResources().getIdentifier(NoteString, "drawable", "com.example.MY-PACKAGE-NAME"));
但是图像不会出现。
如果我说这它的工作原理:
remoteviews.setImageViewResource(R.id.backgroundImage, R.drawable.notebackground);
有什么不对?
你为什么不保证其返回图像位图只是为了确保没有什么不对您的R.java – JoxTraex
@JoxTraex不知道我应该,我是一个初学者,你会怎么做? – Jakob