Help with displaying a Help or Intro Screen

raytronixsystems

Active Member
Licensed User
Longtime User
Hi!

I'm progressing pretty far into my first commercial App - learning all about Android and I'm loving it! B4A is the Best! I have a question: I need to display some mixed rich text and graphics in a scrollable Listview for an introduction to my app. I am not sure the best approach. I need some way to easily edit the intro text with an editor and then package it in the APK. I was thinking about writing the intro in HTML with Word or a WYSIWYG HTML editor but I haven't seen anything yet (or maybe I didn't dig around here enough) about doing a WebView of a local HTML file rather than an internet-based URL. How do you read and display phone-resident HTML files? How do most of you code your scrollable Help and intro screens? I could read each line of text from a file and then stuff it into into a scrollable listview one line at a time(or perhaps 2) but if I have mixed text and graphics and will run into a snag so HTML probably would be my best bet, I was thinking a PDF file but no facility exists in the b4A libraries to display a PDF file in a scrollable llistview - something to add to the Wish List! There are free utils out there to convert a PDF into a BMP/JPG file and then that could be displayed but this approach is not efficient. Not sure how to display a "long" JPG file. Any tutorials on here exist with the answers for my question? I spent last night coding a slick blinking prompt for my Splash Screen -that works well and now ready to move forth with further coding of the business logic of my App. I hope to put it on the Market early next year. I have about 12 Apps going on in my head right now but figure getting the first written and released is my highest priority. I just write down all my ideas and as I code this first app. I write in a manner that makes the code reusable and portable for my future creations. Something we all should do.
thx,
Ray
:sign0085:
 

margret

Well-Known Member
Licensed User
Longtime User
Intro or Help Screen in a WebView

Hello,

This code will do what you want:

B4X:
Sub Globals
     Dim myw As WebView
End Sub

Sub MyIntro
     myw.Initialize("myw")
     Activity.AddView(myw,0,0,600,980)    '*** Set these for to what you need  - left, top, width, height
     myw.JavaScriptEnabled = False
     myw.ZoomEnabled = False
     myw.Visible = True
     myw.LoadUrl("file:///android_asset/intro.htm")
End Sub

Just create the file you want and save it as intro.htm in the Files directory under your project. Just call the sub when you want it. Make sure you copy all images, etc. to the Files directory also. When you wish to remove the window, enter: myw.RemoveView. This same code will work for your help screens too.

Margret
 
Last edited:
Upvote 0

warwound

Expert
Licensed User
Longtime User
And a little tip re Margret's posted code.

You can add the WebView to your Activity with automatic full height and width by using -1 for those properties:

B4X:
Activity.AddView(myw, 0, 0, -1, -1)

Martin.
 
Upvote 0

raytronixsystems

Active Member
Licensed User
Longtime User
thx everyone!
now I'm off to find a decent HTML editor and figure out what to say in my introduction. Hopefully all will go well!
 
Upvote 0

raytronixsystems

Active Member
Licensed User
Longtime User
thx All!

Everything works great! I would like to thank you all for your help - Ray
 
Upvote 0
Top