I have a particular situation: a service started by a broadcast receiver starts an activity. I want to make it possible for this activity to communicate back to the service.
You Must Wait To Complete onCreate() method. Example: Set Your Buy Service in Buttom:
Button button_useservice=findViewById(R.id.button_useservice); button_useservice.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { UsinService(); } });