I created an animated GIF file with 18 frames using photoscape, about 100k, designed a webpage and
set the loadhtml property to the index.html page.. but only the first picture
(frame) of the GIF file is showing. Any idea why the Webview is not displaying the index.html page?
Thanks in advance
p.s.
The animation is fine when open it in IE or Chrome
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("1")
WebView1.LoadUrl("file://" & File.DirInternal & "/index.htm")
End Sub
Try the code below taken from a WebView Sound Sample (I can't find the author although I've searched the forum for WebView Sound Sample). The code requires, Core, and Audio Libraries and You TubeAndroidPlayer api (See Erels post "You Tube Library") for adding sound. The code below was used in a program I wrote for an app called coop2. The Main. bal simply contained a webview for a 7"pad in landscape. The html code was written using a program called "Coffee Cup" and is cited first. It has sound "explosion.mp3", and the gif "android_asset/hulk.gif" in the code listing....that you can change to your assets.
Test.html
B4X:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<TITLE>Test</TITLE>
</HEAD>
<BODY bgcolor="#000000" text="#000000">
<CENTER>
<DIV align="center">
<FONT style="font-size:13px" color="#000000" face="Arial">Click on the picture</FONT></DIV>
<A href="explosion.mp3"><IMG src="android_asset/hulk.gif" alt="" align="top" border="0" width="502" height="309"></A>
</CENTER>
</BODY>
</HTML>
coop2
B4X:
#Region Module Attributes
#FullScreen: False
#IncludeTitle: True
#ApplicationLabel: coop2
#VersionCode: 1
#VersionName: 0.0
#SupportedOrientations: landscape
#CanInstallToExternalStorage: False
#End Region
'Activity module
Sub Process_Globals
End Sub
Sub Globals
Dim Player As MediaPlayer
Dim WebView1 As WebView
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Main")'Set a Webview size for the device
Player.Initialize
Player.Load(File.DirAssets, "sound.mp3")
HTML = File.ReadString(File.DirAssets, "Test.html")
WebView1.LoadHtml(HTML)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause(UserClosed As Boolean)
End Sub
'##########################
'######## Controls ########
'##########################
Sub WebView1_OverrideUrl(Url As String) As Boolean
Try the code below taken from a WebView Sound Sample (I can't find the author although I've searched the forum for WebView Sound Sample). The code requires, Core, and Audio Libraries and You TubeAndroidPlayer api (See Erels post "You Tube Library") for adding sound. The code below was used in a program I wrote for an app called coop2. The Main. bal simply contained a webview for a 7"pad in landscape. The html code was written using a program called "Coffee Cup" and is cited first. It has sound "explosion.mp3", and the gif "android_asset/hulk.gif" in the code listing....that you can change to your assets.
Test.html
B4X:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<TITLE>Test</TITLE>
</HEAD>
<BODY bgcolor="#000000" text="#000000">
<CENTER>
<DIV align="center">
<FONT style="font-size:13px" color="#000000" face="Arial">Click on the picture</FONT></DIV>
<A href="explosion.mp3"><IMG src="android_asset/hulk.gif" alt="" align="top" border="0" width="502" height="309"></A>
</CENTER>
</BODY>
</HTML>
coop2
B4X:
#Region Module Attributes
#FullScreen: False
#IncludeTitle: True
#ApplicationLabel: coop2
#VersionCode: 1
#VersionName: 0.0
#SupportedOrientations: landscape
#CanInstallToExternalStorage: False
#End Region
'Activity module
Sub Process_Globals
End Sub
Sub Globals
Dim Player As MediaPlayer
Dim WebView1 As WebView
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Main")'Set a Webview size for the device
Player.Initialize
Player.Load(File.DirAssets, "sound.mp3")
HTML = File.ReadString(File.DirAssets, "Test.html")
WebView1.LoadHtml(HTML)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause(UserClosed As Boolean)
End Sub
'##########################
'######## Controls ########
'##########################
Sub WebView1_OverrideUrl(Url As String) As Boolean
I try your code and nothing happen. only black screen. When I touch the image (no image, only frame), it also say the mp3 is not found.
However, I notice that I do not have the WebView1_OverrideUrl function because it is missing in your post.
I try your code and nothing happen. only black screen. When I touch the image (no image, only frame), it also say the mp3 is not found.
However, I notice that I do not have the WebView1_OverrideUrl function because it is missing in your post.
1. I use Upper Case name (Ex: Im1.png) => Use all lower case name (Ex: im1.png)
2. Use WebView1.LoadHtml(HTML) or WebView1.LoadUrl("file:///android_asset/Test.htm") => Use WebView1.LoadUrl("file:///android_asset/test.htm")