0
I created a method to encapsulate a notification message (Notification.Builder
). An excerpt from the code is shown below:
public void exibirMensagem(String titulo, String texto,Drawable icone)
{
Notification.Builder mensagem = new Notification.Builder(contexto)
//TROCAR PARA O ÍCONE PADRÃO DA APLICACAO
.setSmallIcon(icone);}
It turns out that the method .setSmallIcone
does not accept the icon object that was passed by parameter. icone is underlined in vermellho and when I step the mouse course appears the following message:
Cannot resolved method 'setSmallIcon(android.graphics.drawable.Drawable
How can I solve this, ie pass a Drawable as parameter and use in the method setSmallIcon
?
You must pass int of the icon by parameter. Example:
exibirMensagem(String titulo, String texto,int icone)
. You do it this way:exibirMensagem("Titulo", "Conteudo",R.drawable.meu_icone)
– viana