Integration of my widget with my application

不打扰是莪最后的温柔 提交于 2019-12-10 04:21:33

问题


I have made a widget that is working fine on its part and also i have made and app for that is working well too in its part.
Now i want to integrate this widget into my application such that both are under same package.

how can i do this ??
do i have to make changes in manifest file.
I have done R&D but all links are for developing the widget from the start..none is on integration.

i have seen alot but found nothing helpful. Please help me in this regard.

Thanks in advance.


回答1:


It work for me by copying all my widget files to the project to which i want to integrate into. Now when i install the application in the device, its widget also gets installed




回答2:


I'm not an apologist of Copy-and-paste programming, so after a bit research we found a way to integrate a widget into several different projects.

  • Turn the Widget project into a Library project : properties -> Android -> and tick Is Library
  • Go to the original project and import the Widget project : properties -> Android -> Add
  • In the original project's Manifest, add the text between the <receiver>(...)</receiver>, including <intent-filter /> and <meta-data/>, into the <application>(...)</application>

And presto, App + Widget integration with no Copy-Paste programming!



来源:https://stackoverflow.com/questions/12001296/integration-of-my-widget-with-my-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!