Service and view
Can i get a view by calling findIdBy(R.id.x) in a Service? th开发者_如何学Pythonanks
Short answer: No.
Should you attempt it: No.
Is it good practice: No.
Would it ever be useful to do this: No.
If you want to do this are you doing something wrong: Yes
Is it possible, in a convoluted way that goes against everything that you should do in an Android idiomatic program: Yes.
You can inflate views defined in an XML file using
getLayoutInflater().inflate(...)
See the SoftKeyboard
example for why and how to do this in a service context
精彩评论