9-patch images in Android WebView - android

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.

Related

What is the common way to get images from urls in android application

I see a lot of android applications just look like html pages, containing many images here and there. But I don't know usually how these applications get their images to render. Do they get images through url. I found some posts on the internet suggested to use AsyncTask to download image through a HttpURLConnection . But I think AsyncTask is a little bit too complicated which involves too much code. Can anyone recommend me a simple,brief and may be also standard approach to get images to render in android applications?Any help is much appreciated!
Use an image loading library, like Glide (https://github.com/bumptech/glide), Picasso (http://square.github.io/picasso/) or Fresco (https://github.com/facebook/fresco) among others.
I will suggest using glide as it is lightweight and easy to use.
Glide
And also has its own many features.

How to load panoroma 360 degree image from url in my android application?

Explanation: I am new to android. I don't know how to load panorama image in my android application.I tried more it's loaded from the drawable folder. But, i want to load it from the url to my android application.
Many of people suggest me to use panoramaGl ready-mate library. i tried this libraries too but not gave the output as much i expected.
Please, help me what is the best solution to load panorama image from url and load into my android application.
Kindly refer, it may help
PanoramaImageView Library with guidance in Android App
Another option is to use Panoramagl-android library

loading SVG on android program

I want to change bitmap images (.png) in my android application to SVG images. I work with the android basic engine.
what is the best solution?
thank you for help :)
SVG is not a image supported by android
http://developer.android.com/guide/appendix/media-formats.html
That means you need custom code to make it work
I haven't tried myself but a quick google search and voila
http://code.google.com/p/svg-android/

Android WebView Grid Display

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!

Display image using a RSS feed

I have an application in which use a RSS feed reader. My problem is that I don't know what is the best way to display an image. The closer I could get was to pull the image description (). I know I could parse this String by myself and get the image url, but I was wondering if there is a more elegant way to solve this issue. I tried using the SAX and the DOM classes, but I couldn't figure it out.
Best way to DISPLAY the image? I'm not sure if that's actually what you're asking, but just use an ImageView. Use an AsyncTask to download the image in the background, and then create a new Drawable from that downloaded image (might even want to cache it to storage) and set that as the source for the ImageView.
there is a library for downloading and caching images in background from the URL
https://github.com/koush/UrlImageViewHelperSample
=)
Are you asking how to get the image URL from the XML RSS feed? There's nothing built into the SDK that's going to help you parse the XML, other than SAX or DOM which you have already noted. There is a learning curve to those, but they are reasonable approaches.
There's a project called ROME that is an API for robustly parsing all sorts of feeds, including RSS. You could import this library into your android app. Note that this library has other dependencies, so you'd have to import them also. I haven't done it personally, but I have heard of people using ROME in Android apps, so it's doable.
Or more simply, if you just want the image URL and you don't need a complete feed parser, you can use java.util.regex to parse out the fields you want.
If you are asking how to display the image after you have the URL, kcoppock's answer explains it.

Categories

Resources