Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个应用程序在家里有一个小部件按钮,现在我想要如果我从我的应用程序的活动中按下按钮,那么小部件按钮文本应该被更改。Activity 和 Widget 都来自同一个应用程序。
从您的应用发送一个并在您的应用小部件Intent中对其进行评估:OnReceive
Intent
OnReceive
应用程序:
Intent i = new Intent(ACTION_MYWIDGET_CHANGE); sendBroadcast(i);
小部件:
String action = intent.getAction(); if (action.equals(ACTION_MYWIDGET_CHANGE)) {...}