mardi 12 mai 2015

How to replace findViewById() with LayoutInflater.inflate() for a watch view stub

I have a watch app but am investigating replacing the activity with a system overlay window.

The standard way of inflating a wearable's layout is to use:

 WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);

However, if I am no longer using the activity instead I will be creating the system overlay window in a server. Searching for how to do this all the answers suggest using LayoutInflator's inflate() method. However that takes a resource as a parameter, not a resource id.

How can I a load the WatchViewStub without using findViewById()? Or is there a way of using findViewById() from within a service?

Aucun commentaire:

Enregistrer un commentaire