Re: [android-developers] WebView Image Scaling
By tiling the image, do you mean splitting it up and putting it back together with HTML to display in the WebView? How does this avoid heap size problems? Does WebView do some magic behind the scenes? I'd like to avoid writing my own ImageView zoomer if that is going to open up more problems than I already have. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] WebView Image Scaling
On Tue, Apr 12, 2011 at 11:20 AM, Jake Basile jakerbas...@gmail.com wrote: By tiling the image, do you mean splitting it up and putting it back together with HTML to display in the WebView? No, I mean splitting it up and showing only the portions that are needed based on the center and zoom levels. See: Google Maps. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9.2 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] WebView Image Scaling
Ahh, ok. I was checking if there was something I was missing that does that automatically. Do you know of any open source control that does something similar, as it seems like a pretty common thing? -- Jake Basile http://jakebasile.com/ On Tue, Apr 12, 2011 at 6:25 PM, Mark Murphy mmur...@commonsware.comwrote: On Tue, Apr 12, 2011 at 11:20 AM, Jake Basile jakerbas...@gmail.com wrote: By tiling the image, do you mean splitting it up and putting it back together with HTML to display in the WebView? No, I mean splitting it up and showing only the portions that are needed based on the center and zoom levels. See: Google Maps. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9.2 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] WebView Image Scaling
On Tue, Apr 12, 2011 at 7:20 PM, Jake Basile jakerbas...@gmail.com wrote: Ahh, ok. I was checking if there was something I was missing that does that automatically. Do you know of any open source control that does something similar, as it seems like a pretty common thing? Off the top of my head, no, sorry. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9.2 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] WebView Image Scaling
Oh well, thanks for the info. I'll figure something out - probably rolling my own. It does seem like something common enough that it should be in the default widgets, maybe in some future version. -- Jake Basile http://jakebasile.com/ On Tue, Apr 12, 2011 at 7:42 PM, Mark Murphy mmur...@commonsware.comwrote: On Tue, Apr 12, 2011 at 7:20 PM, Jake Basile jakerbas...@gmail.com wrote: Ahh, ok. I was checking if there was something I was missing that does that automatically. Do you know of any open source control that does something similar, as it seems like a pretty common thing? Off the top of my head, no, sorry. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9.2 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] WebView Image Scaling
I am writing an image viewer that downloads a PNG from a remote server, saves it to storage, and then opens it in a WebView so that I get multi-touch zoom for free. These images are usually going to be documents, so the user will want to be able to zoom in very far. I am sending down images of sufficient resolution to enable this, but the WebView seems to be helping me by scaling my image to the screen size to start out with. This means that my image is much too low resolution to be properly zoomed in on. I have searched around for this, and I have found some other people encountering a similar../d/msg/android-developers/ZXiqdqa8Tos/I_J8YR1As94J problem ../d/topic/android-developers/oc4e-SwFJbY/discussion, but the only possible solution I found was to cut the image up into tiles and reassemble them using HTML before loading it in the view. This seems like a kludge, and I am asking if anyone has either a way to turn off that scaling, or an alternative method to get what I need. The code that initializes the WebView: viewer = (WebView)findViewById(R.id.activity_imageviewer_webview); viewer.setBackgroundColor(0); WebSettings settings = viewer.getSettings(); settings.setJavaScriptEnabled(false); settings.setBuiltInZoomControls(true); settings.setUseWideViewPort(true); settings.setLoadWithOverviewMode(true); The code that loads the image into the WebView: viewer.loadUrl(Uri.fromFile(imageFile).toString()); -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] WebView Image Scaling
On Mon, Apr 11, 2011 at 1:42 PM, Jake Basile jakerbas...@gmail.com wrote: I am writing an image viewer that downloads a PNG from a remote server, saves it to storage, and then opens it in a WebView so that I get multi-touch zoom for free. These images are usually going to be documents, so the user will want to be able to zoom in very far. I am sending down images of sufficient resolution to enable this, but the WebView seems to be helping me by scaling my image to the screen size to start out with. This means that my image is much too low resolution to be properly zoomed in on. I have searched around for this, and I have found some other people encountering a similar problem, but the only possible solution I found was to cut the image up into tiles and reassemble them using HTML before loading it in the view. This seems like a kludge, and I am asking if anyone has either a way to turn off that scaling, or an alternative method to get what I need. The code that initializes the WebView: viewer = (WebView)findViewById(R.id.activity_imageviewer_webview); viewer.setBackgroundColor(0); WebSettings settings = viewer.getSettings(); settings.setJavaScriptEnabled(false); settings.setBuiltInZoomControls(true); settings.setUseWideViewPort(true); settings.setLoadWithOverviewMode(true); The code that loads the image into the WebView: viewer.loadUrl(Uri.fromFile(imageFile).toString()); If the image is big enough to warrant zooming, it might well be too big for your heap space, in which case you'd need to tile it, anyway. Beyond that, I would think it would be simpler just to implement your own zoom logic on an ImageView: http://blogs.sonyericsson.com/developerworld/category/tutorials/zoom/ http://www.zdnet.com/blog/burnette/how-to-use-multi-touch-in-android-2-part-6-implementing-the-pinch-zoom-gesture/1847 http://stackoverflow.com/questions/3055133/android-multitouch-image-zooming/3059280#3059280 or use existing multi-touch-enabled widgets: http://code.google.com/p/android-pinch/ -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.6 Available! -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en