I am having some problems with a webview I am using to access a specific URL within my Activity. When I load this exact same URL on a PC browser such as firefox, the edges of the grid are displayed
When I try to load the same URL from within my WebView by using
webView.loadURL("www.url.com");
I get the following grid.
Any ideas on how I can fix this? It's not a major issue, just annoying.
And this isn't real data, so don't worry about that.
I don't know that much about HTML so maybe this is an HTML issue?
Apologize for using imageshack, I can't post images yet.
Have you tried scrolling to the side? Does it display the images, then?
You might try the following:
Building webpages to support different screen densities
Take a look at the Android documentation there. It should give you a good example of how to get your data to display properly on any device.
Hope this helps!
Related
This might seem to you guys as a stupid question, but it comes into my mind so many times:
Why is there an ImageView in Android? We have a WebView, which is capable of displaying images, and so much more stuff. So why would you provide an ImageView as well? Maybe there is some fundamental reason for this, but I just don't see it. Whenever I want to use some media, I try to use a WebView, because this allows me to change the type of media if I wish to do so, and I do not need another Type of View.
So to not make this question to broad, let's bring it down to this:
In which scenario does an ImageView have big advantages over a WebView?
EDIT
And a second question:
If I have some audio, some html-text and some pictures, which are stored locally on my device, would I use one WebView to display them, or would I use one Type of View for each Type of media?
WebView is a much more expensive widget to use, in terms of memory consumption, than is ImageView.
The reason for the memory cost of WebView is the fact that WebView is powered by a fairly complete copy of WebKit. WebKit is an open source Web rendering engine that forms the heart of major Web browsers, such as Chrome and Safari. While the version of WebKit that lives in Android is one optimized for mobile use, it still represents a fairly substantial code base, and rendering complex Web pages takes up a fair amount of RAM (as anyone with lots of browser tabs on their desktop knows all too well).
FACT: The WebView implementation is such that it will consume more memory if used to download & display images. Always. Also, ImageView has special methods / XML tags for cropping, resizing, scaling & manipulating images (which WebView doesn`t).
A person has a image in the gallery. The persom wants to show it inside the app. What will it do?
Go and host it on an online image hosting website and then pass the url to the WebView?
That ain't a cool Idea.. and people and Google understand that.
Basically image view using for showing image from gallery , drawable or url.Webview for handling or showing web content or html kind of thing.
Well ImageView consumes less memory. ImageView can change the image display options.
ImageView can display images from different sources like "Resources, drawables".
WebView mainly for displaying html pages.
I would like to ask advise if displaying pdf inside gridview instead of image is possible. I have tried to display list of websites in gridview using webview. Now, I want to make it a list of pdf files inside gridview. Normally same with if you open your folder in your linux laptop and have the thumbnails of your pdf, things like that. I want to achieve that in my application. I would really appreciate any of your advice, no codes needed cause i will handle it my self. I just want to have some theories. thanks and HAPPY NEW YEAR GUYS
I think what you're going to have to is convert the pdf's into a bitmap first, then load into an ImageView, check out this post and also look into other pdf rendering libraries for Android.
I'm a newcomer in development of android apps. But, I'm undertaking what feels like a large project and I'm looking for information on whether it will work or not, before I get to far in.
As I've read, when trying to display very large images in android, it is most useful to use the "webview".
So, I took that advice, split my image into 1024 smaller images, and laid them out in an html table (not quite finished yet). Now, I'm noticing as the table gets larger my phone begins to lag upon scrolling.
My question is, is webview trying to render every single picture at once upon loading? If so, is there a way to make webview only render a set of images at one time? Let's say I'm at 14,000X x 24,000Y on the image, can I set webview to render the next 5,000px in each direction only, or is this necessary at all?
I can't seem to find the information I'm looking for, but will continue to search. Otherwise, any and all help is appreciated. Thanks!
i have exactly same problem and i found use full this library:
https://github.com/nostra13/Android-Universal-Image-Loader
you can configure a lot of parameters and using cache..
Do 9-patch images work inside an Android WebView? I haven't found anything that definitively answers it one way or another. I know there's a project that uses Javascript to mimic it on the web (https://github.com/chrislondon/9-Patch-Image-for-Websites), so I figure to use that as a workable alternative but wondered if anyone else had ideas.
I think it is feasible and there are several ways that we could have a try.
Do it in js/css. Just as you mentioned, there are several js plugin that support parsing 9patch. And css3 also has a new feature named border-image, which could achieve the same result.
Do it in android. If it is only used in android, we can use WebView.addJavascriptInterface() and enable js to invoke android code. When javascript want a image, it send the image uri and desired size of the image to android. Android try to load the image and use NinePatchDrawable to parse it. Convert it to a bitmap and return back.
I'm new to android/phonegap development. I'm trying to access external images but I only get black places where the image should be on the emulator.If I try to open the html in chrome it displays the image. I already added the domain to the white list.
Would you be so kind as to help me figure out what the problem could be?
Thank you,
Henrik
Please check the case of the images names. See if the browser is also displaying the image or not
It was just an error of the emulator, when I tried on an actual device all worked fine!