Not allowed to bind to service Intent

前端 未结 6 1991
时光说笑
时光说笑 2020-12-31 10:42

I write an android service of get weather, and the AndroidManifest.xml is:




        
6条回答
  •  甜味超标
    2020-12-31 11:11

    In ur activity class do ... suppose BothButton is Activity class name and CleverTexting is Service class name, And u want to call an activity from a service and than service from activity . If ur code is working fine in more than 4.0 android version than u can do like this there will not be any problem.

    CleverTexting mService ; 
    
    public void setService(CleverTexting listener) {
        // TODO Auto-generated method stub
         mService = listener;
    }
    

    and in ur Service class do... where u want to call ur activity

    BothButton mBothButton;
    
    mBothButton = new BothButton(this);
        mBothButton.setService(this);
    

提交回复
热议问题