onServiceConnected never called after bindService method

后端 未结 12 662
醉话见心
醉话见心 2020-11-30 05:48

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.

12条回答
  •  温柔的废话
    2020-11-30 06:15

    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();
                    }
                });
    

提交回复
热议问题