I am very very happy today.
I have been able to complete the app I was trying for last few months.
My goal was to,
make a widget app
make it in B4XPages
it would download html from url
parse the html and extract text
show the text in the widget
would run every hour or so
I have achieved in all my goals, thanks to B4X.
Taking cue from Saif, I start by thanking @Erel.
Not only because Erel made B4X but also it is Erel's widget sample code which I took as inspiration.
It is a Quotes Widget, very old and uses old libraries which give errors now, as discussed here,
Below are the screen-shots of my "B4A Quotes Widget" app.
In main screen you enter the url (taken one from original sample of Erel). Check it with 'Load Quote' button. 'Save & Close' the app.
In widget touch the 'play' button and it will load quote from the url and display. There are 4 quotes and widget displays them one after another.
Widget will auto load quote every hour.
A clock is also running to show that the widget is active. May be it will stop in higher Android version.
Widget need internet connection and will show failed if not found.
I have checked it in Android 5 Lenevo only but would like feedback in Android 10+, if any member have one.
I have attached the project source codes and request members to play with it. If one can enhance it, upload the code here for benefit of other members.
I have plan to add radio buttons for urls as given in original sample of Erel, to select. So that user can just select the one required. Also to have touch event in widget to open the main activity.
Regards,
Anand
version 2 : manifest correction for Android 10+ on 06 May 2021
version 1 : initial release on 06 May 2021
I have been able to complete the app I was trying for last few months.
My goal was to,
make a widget app
make it in B4XPages
it would download html from url
parse the html and extract text
show the text in the widget
would run every hour or so
I have achieved in all my goals, thanks to B4X.
Taking cue from Saif, I start by thanking @Erel.
Not only because Erel made B4X but also it is Erel's widget sample code which I took as inspiration.
It is a Quotes Widget, very old and uses old libraries which give errors now, as discussed here,
Widget fetch http tutorial error
I am trying to make a widget. It will download version.txt from g drive and show the version number. Simple. I read and compiled below and found Ok https://www.b4x.com/android/forum/threads/android-home-screen-widgets-tutorial-part-i.10166/#content I read and compiled below but error. Added...
www.b4x.com
Below are the screen-shots of my "B4A Quotes Widget" app.
In main screen you enter the url (taken one from original sample of Erel). Check it with 'Load Quote' button. 'Save & Close' the app.
In widget touch the 'play' button and it will load quote from the url and display. There are 4 quotes and widget displays them one after another.
Widget will auto load quote every hour.
A clock is also running to show that the widget is active. May be it will stop in higher Android version.
Widget need internet connection and will show failed if not found.
I have checked it in Android 5 Lenevo only but would like feedback in Android 10+, if any member have one.
I have attached the project source codes and request members to play with it. If one can enhance it, upload the code here for benefit of other members.
I have plan to add radio buttons for urls as given in original sample of Erel, to select. So that user can just select the one required. Also to have touch event in widget to open the main activity.
Regards,
Anand
version 2 : manifest correction for Android 10+ on 06 May 2021
version 1 : initial release on 06 May 2021
Attachments
Last edited: