简体   繁体   English

使小部件与已在应用程序中的按钮执行相同操作的最简单方法?

[英]Easiest way to make a widget do the same thing as a button that is already in-app?

I have an app that contains a button that plays short sound when clicked. 我有一个包含按钮的应用程序,单击该按钮可播放短促的声音。 I'd like to basically make a widget that will do the same thing from homescreen. 我想基本上制作一个小部件,它将在主屏幕上执行相同的操作。

What's the easiest way to make such a widget? 制作此类小部件的最简单方法是什么?

Thank you. 谢谢。

This Building app widgets seems to provide some pretty good instructions in order to make your widget. Building应用程序小部件似乎提供了一些非常好的说明,以便制作您的小部件。

Goodluck! 祝好运!

I believe that Play sound on widget click answers your question. 我相信在小部件单击上播放声音可以回答您的问题。

Widgets themselves don't have any API that will let you play sounds however running a service in your app and triggering the service calls on click events in your widget should work. 窗口小部件本身没有任何API可以让您播放声音,但是在您的应用程序中运行服务并触发窗口小部件中单击事件的服务调用应该可以。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM