Bakih
Bakih

Reputation: 286

Service and view

Can i get a view by calling findIdBy(R.id.x) in a Service? thanks

Upvotes: 0

Views: 326

Answers (2)

Aharon Manne
Aharon Manne

Reputation: 712

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

Upvotes: 0

Rich Schuler
Rich Schuler

Reputation: 41972

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.

Upvotes: 4

Related Questions