I am trying to add images in a webview for each 3 column but the image are displayed outside the table in horizontal. where am i wrong ? a hint please.
String str = "";
str += "<table width='200' border='1'><tr>";
int i = 1;
for (i=1; i < my_image.length-1; i++) {
if (i%3==0) {
str += "<td><a href='"+my_image[i]+"'"+" class='popup-open'><img src='"+my_image[i]+""+"width='80' height='65'></a></td></tr><tr>";
} else {
str+= "<td><a href='"+my_image[i]+"'class='popup-open'><img src=' "+my_image[i]+"' width='80' height='65'></a></td></tr>";
}
str+="</tr></table>";
}
html_content = "<strong>"+title+"</strong>" +
" <br><br><img src='"+single_image+"'width='300' height='211'>" +
"<br> " +
""+content+"<br>"+str;
Almost certainly you aren’t closing a tag somewhere every opening HTML tag should be closed.
You are definitely ending your table with
<tr></tr>which is not very nice.You should definitely do some research into using JSP or similar. Using JSTL within your JSPs would be much preferable, easier to read and more maintainable in the long run. An hour’s reading of a JSTL / JSP tutorial would save you many in the future.
EDIT:
Actually it looks like you aren’t closing the
'around the src attribute:str += "<td><a href='"+my_image[i]+"'"+" class='popup-open'><imgsrc='"+my_image[i]+""+
should be:
str += "<td><a href='"+my_image[i]+"'"+" class='popup-open'><imgsrc='"+my_image[i]+"'"+
Also using width and height attributes is bad form. Set a class using the class attribute and size the images with CSS – it will prevent headaches / code changes if you want to change the size of the images at any point in the future.