How to find view id in appwidgetprovider?

I have an appwidget extending from appwidgetprovider.

I created an XML layout file called main_layout.xml and add a button. If I develop listActivity, I will get to this button using this path: R.layout.main_layout.button01.

(Button)findViewById(R.layout.main_layout.button01) 

The activity class has a member method called findViewById (), but appwidgetprovider does not.

How can I get my button in my layout?

sorry for my English

+4
source share
1 answer

You cannot directly link or change views in Appwidget. You must do this in RemoteViews .

+3
source

Source: https://habr.com/ru/post/1335211/


All Articles