Android Get Screen dimensions from Service

后端 未结 4 2117
Happy的楠姐
Happy的楠姐 2021-02-02 08:35

I got the Screen Size by using the following from a activity,

Display display = getWindowManager().getDefaultDisplay();

But the same thing is n

4条回答
  •  天命终不由人
    2021-02-02 08:47

    If you are starting the service on boot (or automatically any other way) then shared prefs is a good way. However, if the only way you start the service is thru calling Context.startService() then it actually makes more sense to just place an extra in the Intent that you use to start the service.

提交回复
热议问题