label and html

624 views
Skip to first unread message

Fabrizio Pivari

unread,
Aug 29, 2016, 4:23:23 PM8/29/16
to MIT App Inventor Forum
label displays correctly html tags.
it displays also links using blue but they don't work.
I've documentation but I've not understand the better way to use links. I've the links in a global variable and I write <a href="global variable">global variable</a>

Thanks

Fabrizio

Taifun

unread,
Aug 29, 2016, 6:44:26 PM8/29/16
to MIT App Inventor Forum
label displays correctly html tags.
it displays also links using blue but they don't work.
yes exactly, because a label is only a label to display something and is not a webviewer...
 
I've not understand the better way to use links
what exactly are you trying to do?
if you want to follow a link, use the webviewer together with the GoToUrl method to open a link

GoToUrl(text url)
Load the page at the given URL.

Taifun

Trying to push the limits of App Inventor! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun. 

Fabrizio Pivari

unread,
Aug 30, 2016, 4:43:33 AM8/30/16
to MIT App Inventor Forum
> what exactly are you trying to do?
> if you want to follow a link, use the webviewer together with the GoToUrl method to open a link

Correct I want to follow a link with a video from youtube or vimeo.
Can I introduce webviewer in the label?

Thanks

Fabrizio

Taifun

unread,
Aug 30, 2016, 10:17:59 AM8/30/16
to MIT App Inventor Forum
use a button to open the webviewer together with that link
Taifun

Fabrizio Pivari

unread,
Aug 30, 2016, 11:00:52 AM8/30/16
to MIT App Inventor Forum
Is it the best way to use webviewer or activity starter?

Thanks

F

Taifun

unread,
Aug 30, 2016, 11:33:52 AM8/30/16
to MIT App Inventor Forum
just try both options to find out its advantages and disadvantages
Taifun

Fabrizio Pivari

unread,
Aug 30, 2016, 5:29:58 PM8/30/16
to MIT App Inventor Forum
I've not understood.
If I create an html inside a string
e.g. "<html><head></head><body><b>this is a string</b> with a link <a href="http://...">the link</a></body></html>
how can I display it using webviewer? (label doesn't work with links).

Thanks

F

Taifun

unread,
Aug 30, 2016, 6:31:58 PM8/30/16
to MIT App Inventor Forum
a button, which opens the webviewer with your link looks like this


Taifun

Fabrizio Pivari

unread,
Aug 31, 2016, 9:57:07 AM8/31/16
to MIT App Inventor Forum
If the app creates an "html page" on the fly and puts it inside a string, how can the app open it?
I've to save the data in a file on the phone, can I read them from string?

Thanks

F

Taifun

unread,
Aug 31, 2016, 10:23:19 AM8/31/16
to MIT App Inventor Forum
yes, you can create a webpage during runtime of the app and store it on the sdcard of the device, just use the file component to save the file, then use the webviewer to display it

 and puts it inside a string
???

Taifun

Fabrizio Pivari

unread,
Aug 31, 2016, 10:28:40 AM8/31/16
to MIT App Inventor Forum
OK, this is a possible way.
My question is:
why don't add with
webviewer GoToUrl url
anything like
webviewer ReadFromString string
?

Thanks

F

Taifun

unread,
Aug 31, 2016, 12:45:53 PM8/31/16
to mitappinv...@googlegroups.com
meanwhile I prepared a small example, which uses a HTML file stored in the assets of the app to display any text you are passing from App Inventor to the Webviewer using the webviewstring property, details see here https://puravidaapps.com/snippets.php#2webviewstring2


Taifun


Fabrizio Pivari

unread,
Aug 31, 2016, 1:13:17 PM8/31/16
to MIT App Inventor Forum

I've made a simple example, I've to test it.
Is it correct?

F

Taifun

unread,
Aug 31, 2016, 6:40:46 PM8/31/16
to MIT App Inventor Forum
I've to test it.
to put some blocks together and to hope that they will work without testing does not help very much

it also might help to read the documentation http://ai2.appinventor.mit.edu/reference/components/storage.html#File
let me recommend you to store the file to the sdcard...

SaveFile(text text, text fileName)
Saves text to a file. If the filename begins with a slash (/) the file is written to the sdcard (for example, writing to /myFile.txt will write the file to /sdcard/myFile.txt). If the filename does not start with a slash, it will be written in the program's private data directory where it will not be accessible to other programs on the phone. There is a special exception for the AI Companion where these files are written to /sdcard/AppInventor/data to facilitate debugging. Note that this block will overwrite a file if it already exists. If you want to add content to a file use the append block.

btw. to have a simpler solution, you might want to follow my example above...

Taifun
Reply all
Reply to author
Forward
0 new messages