I have the error when I try to get values of class to other class. I search on StackOverFlow and try many methods before asking this question. I think the problem is my class extends from Services.
This is full error in log:
Unable to find explicit activity class {kr.co.composer.callrecord/kr.co.composer.callrecord.recorder.CallRecordService}; have you declared this activity in your AndroidManifest.xml?`
My code to set values:
public class ConfigurationActivity extends AppCompatActivity { btnSaveURL.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String textURL = serverUrl.getText().toString(); Intent i = new Intent(getBaseContext(), CallRecordService.class); i.putExtra("textServerURL", textURL); startActivity(i); } });
And in class CallRecordServices.java
:
public class CallRecordService extends Service { @Override public int onStartCommand(Intent intent, int flags, int startId) { serverURL = intent.getStringExtra("textServerURL"); return super.onStartCommand(intent, flags, startId); }
Finally, this is file Manifest.xml
:
<application> <service android:name="kr.co.composer.callrecord.recorder.CallRecordService"></service> </application>
Answer
You are calling startActivity(i);
but you need to call startService(i);
instead.