将一个Object从Service传递给Fragment

时间:2017-03-08 10:55:12

标签: java android android-intent android-service

我想将一个Object从Service传递给Activity。我应该使用Intents和具有Parcelable接口的对象吗?!如果是这样,我在Activity中有一个BroadcastReceiver吗?

//in the service class        
qId = new QueueIdentifier(sensorUnits.get(sensorUnits.size()-1).getDeviceDescriptor(),
                sensorUnits.get(sensorUnits.size()-1).getMasterID());
        //send qId to DeviceListFragment --> DeviceListFragment is already exist
        Intent intent = new Intent(this, DeviceListFragment.class);
        intent.putExtra("qid",qId);

0 个答案:

没有答案