Hello.
Can anyone advise?
I want to display about 150 html files in the app via the menu. Can I import those files into app assets?
Each file has about 150 lines.
Won't the app be too big?
And how do I "call" that html to a menu item and then to a screen?
A 150 line html file is going to be @ 5.2kB in size, therefore 150 files will be @ 850kB.
These will easily fit inside your app in the Assets, however, such a large number of files may cause file and compilation issues. I say may, it could all work perfectly well
AI2 has a special url for html files in assets:
http://localhost/myfile.html
You set this in the webviewer.GoToUrl block
As an alternative, you could set up a routine to download all the files to your ASD or Shared Storage on first run of the app. The file path would then be, for example if files in the ASD:
Thanks.
Theoretically, I could merge those html files into one file, but I can't imagine how to call them separately in the screen via the menu.
Ondrej
Yes, theoretically you could just have one big html file, and use javascript/html/css (whatever) to display the correct file. You could use the webviewstring to send a value from the app, the javascript would then display the html as specified by the value sent. Something like:
//......
<script>
// hide all divs
var divs = document.getElementsByTagName("div");
for (var i = 0; i < divs.length; i++) {
divs[i].style.display = 'none';
}
//show div based upon supplied display number
var displayNo = window.AppInventor.getWebViewString();
document.getElementById(displayNo).style.display = 'block';
</script>
//.....
<body>
<div id=1></div>
<div id=2></div>
<div id=3></div>
</body
Yes. You can drag and drop them. It is a slow process (not the dragging, but AI's processing). Sometimes some files don't go into the Media correctly and you have to redo those particular files. Alternatively you can us an unzip tool to explode the aia and enter the html files by adding them there).
Yes. I have an app that uses about 1000 html files that are text only. The size limit is 5mb; I don't know what the number of files limit is but 1000 works for me ; 150 should not be a problem. Why not try, the dragging and drop to import the htmls is easy and should not take long. Experiment.
You do not need ASD although that could work. Storing in Media, provided you later do not have to modify the files is OK.
As others stated, you will probably need to use the code... server. I have to.
The app's aia takes several minutes to render. You need to be patient. The compiled apk loads fast.
As said previously Anke, code.appinventor works fine to build the APK and export the aia; the main server balks and chokes and cannot build an aia or apk.
You have to have faith. “O you of little faith, why did you doubt?” Matthew 14:31 . I did it a few weeks ago. I started to write a tutorial but didn't think anyone would be interested.
[quote="SteveJG, post:9, topic:52314"]
As others stated, you will probably need to use the code... server. I have to.
[/quote] (should have said too instead of to )
The main server can not handle that many files. so use code... server and your Project should compile/load. Try it. Developers have to experiment. I can do it with my htmls.
my understanding is the http://code.appinventor.mit.edu.ezproxy.canberra.edu.au/ runs on the Amazon server. That is the server I used with my Project to compile and create the aia for a Project with larger numbers of htmls. I have no idea what the limit of files might be. My Project has in excess of 1000 of html files. I didn't count exactly how many.