phonegap

 

Getting Started with PhoneGap (WiMo)

Page history last edited by mboehmer 6 mos ago

Comments (1)

profile picture

hemisphire said

at 11:28 am on Sep 4, 2009

Not sure if this is a good place to add this, but I wanted to add images to the example web page. It worked fine in my browser on the desktop as style="background-image:url(images/img01.bmp)", but I had to parse the HTML and replace it with the full path (images were added as a subdirectory to www in Solution Explorer, build action = content, copy to output = copy if newer):

Instead of readEmbedded's last line of
return reader.ReadToEnd();

I did this:

String documentText = reader.ReadToEnd();
int position = documentText.IndexOf( "images/" );
String pathName = "file://" + Path.GetDirectoryName( assembly.GetName().CodeBase ) + "\\www\\images\\";
int pathNameLength = pathName.Length;
while( position > 0 )
{
documentText = documentText.Remove( position, 7 );
documentText = documentText.Insert( position, pathName );
position = documentText.IndexOf( "images/", position + pathNameLength );
}
return documentText;

You don't have permission to comment on this page.