I am using the following notification
NotificationCompat.Builder builder = new NotificationCompat.Builder( getApplicationContext(), default_notification_channel_id ) ;
String currentDate = new SimpleDateFormat("dd-MM-yyyy", Locale.getDefault()).format(new Date());
builder.setContentTitle( "test! "+currentDate ) ;
builder.setContentText("test text!") ;
PendingIntent pendingIntent =
PendingIntent.getActivity(getApplicationContext(), 10, new Intent(getApplicationContext(), MainActivity.class),0);
builder.setContentIntent(pendingIntent);
builder.setDefaults(Notification.DEFAULT_SOUND);
builder.setAutoCancel( true ) ;
Drawable drawable= ContextCompat.getDrawable(this,R.drawable.notificationstoreicon);
Bitmap bitmap = ((BitmapDrawable)drawable).getBitmap();
builder.setLargeIcon(bitmap); //bitmap dimensions 512x512 size 768kb xxxhdpi in drawable folder
builder.setSmallIcon(R.drawable.transparenticon) ;
builder.setChannelId( NOTIFICATION_CHANNEL_ID ) ;
This specific line builder.setLargeIcon(bitmap);
is causing the app to crash on emulator. Its working on my tablet android device.
How should i use the bitmap to overcome the crash on the emulator?