android - Move an object from one Activity to a Service -
android - Move an object from one Activity to a Service -
i need move object activity service. effort @ activity side.
waveform waveform = new waveform(); intent intent = new intent(this, stimulationservice.class); bundle bundle = new bundle(); bundle.putparcelable("test", (parcelable) waveform); intent.putextras(bundle); startservice(intent);
i have placed code in onstart() function in service.
bundle bundle = this.getintent().getextras(); if(bundle!=null) mwaveform = bundle.getparcelable(waveform);
i'm getting errors function "getintent" , "waveform" within getparcelable(). help or guidance appreciated.
services don't have getintent
method. instead intent passed in argument onstart
method. should utilize parameter instead. the getparcelable
method takes string
, in case of test code, should "test"
.
android android-intent android-activity
Comments
Post a Comment