I'm doing an Android app and am having a question while generating a notification.
Here's a snippet of code:
public void gerarNotificacao(View view) {
NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
SimpleDateFormat datas = new SimpleDateFormat("dd/mm/yyyy");
mDiasdaSem = String.valueOf(datas.format(new Date()));
eventoDao = new eventosDao(this);
eventoDao.open();
String filtro = mDiasdaSem;
List<Eventos> eventos = eventoDao.listarEventos(filtro);
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
builder.setTicker("Ticker Texto");
builder.setTicker( (CharSequence) eventos);
builder.setSmallIcon(R.drawable.ic_launcher);
Notification n = builder.build();
n.vibrate = new long[]{250, 300, 150, 600};
nm.notify(R.drawable.ic_launcher, n);
try
{
Uri som = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
Ringtone toque = RingtoneManager.getRingtone(this, som);
toque.play();
}
catch(Exception e)
{
}
}
The following error occurs:
java.util.ArrayList can not be cast to java.lang.CharSequence
How to solve?