Integration of my widget with my application

2019-04-28 14:52发布

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.

2条回答
ら.Afraid
2楼-- · 2019-04-28 14:56

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

查看更多
迷人小祖宗
3楼-- · 2019-04-28 15:18

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!

查看更多
登录 后发表回答