Rafraichir une ListView a partir d'un service en backgroung
Bonjour je cherche a Rafraichir une listView a partir d'une fonction retour de Firebase
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
String myMessage = remoteMessage.getNotification().getBody();
Log.d("FireBaseMessage", myMessage);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, CANAL);
notificationBuilder.setContentTitle("Perchage");
notificationBuilder.setContentText(myMessage);
notificationBuilder.setSmallIcon(R.mipmap.ic_icone);
//Envoie de la Notif
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
String channelId = getString(R.string.notification_channel_id);
String channelTitle = getString(R.string.notification_channel_title);
String channelDescription = getString(R.string.notification_channel_desc);
NotificationChannel channel = new NotificationChannel(channelId, channelTitle, NotificationManager.IMPORTANCE_DEFAULT);
channel.setDescription(channelDescription);
notificationManager.createNotificationChannel(channel);
notificationBuilder.setChannelId(channelId);
} |
Et voici L'activité qui est déjà en route
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
public class List extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list);
ListView listView = (ListView) findViewById(R.id.List);
DI Point1 = new DI((long) 123, 123, "test");
DI Point2 = new DI((long) 123, 123, "test2");
DI Point3 = new DI((long) 123, 123, "test2");
DI[] Points = new DI[]{Point1,Point2,Point3};
ArrayAdapter<DI>Liste=new ArrayAdapter<DI>(this,android.R.layout.simple_list_item_1,Points);
listView.setAdapter(Liste);
}
} |
Je ne vois pas comment rafraichir la listView a partir de onMessageReceived
Pouvez vous m'aider?