3

When I put a text and a bitmap into an app they both work. The code is:

TextView textView = findViewById(R.id.textView);
textView.setText("This works");
ImageView testView = findViewById(R.id.imageView);
testView.setImageBitmap(bitmap);

If I try to put the same text and bitmap into a widget, only the text shows up. The code is:

remoteViews.setTextViewText(R.id.textView, "This works");
remoteViews.setImageViewBitmap(R.id.imageView,bitmap);

Logcat shows "Failed execv...because non-0 exit status"

What am I doing wrong?

Lyle G
  • 31
  • 4

1 Answers1

0

In case anyone else stumbles on this, I found the answer to this here

Basically, after calling setImageViewBitmap, you need to call appWidgetManager.updateAppWidget(COMPONENT_NAME, remoteViews), so your code should essentially look something like this:

remoteViews.setImageViewBitmap(R.id.your_image_view_id, bitmap)
val COMPONENT_NAME = ComponentName(context, YourEmojiWidget::class.java)
appWidgetManager.updateAppWidget(COMPONENT_NAME, remoteViews);
Mira_Cole
  • 763
  • 6
  • 13