0
ListViewをリフレッシュしたいと思います。私のサービスでは、私はオブジェクトのリストを準備しています。どのようにオブジェクトのリストを送信し、ListViewで受信するのですか?Androidブロードキャストオブジェクトリストの送受信方法
マイサービス
@Override
public void onLocationChanged(Location location) {
//populate list
//send list
sendLocationBroadcast(poiList);
}
private void sendLocationBroadcast(List<Poi> poiList) {
Intent locationIntent = new Intent();
locationIntent.setAction(LOACTION_ACTION);
locationIntent.putExtra(LOCATION_MESSAGE, poiList.toString());
LocalBroadcastManager.getInstance(this).sendBroadcast(locationIntent);
}
そしてメインの活動
@Override
public void onReceive(Context context, Intent intent) {
if (null != intent && intent.getAction().equals(LOACTION_ACTION)) {
String locationData = intent.getStringExtra(LOCATION_MESSAGE);
ArrayList<Poi> dataList = (ArrayList<Poi>) intent.getSerializableExtra("DATA_LIST");
}
}
これを修正するには?