Android :: Does ImageView.setImageURI(Uri Uri) Work With Remote Files
Jun 19, 2010Can you make an ImageView load an image from a remote server through the ImageView.setImageURI(URI uri) method?

Can you make an ImageView load an image from a remote server through the ImageView.setImageURI(URI uri) method?
I am displaying images and some text in a list view with an adapter. The images are pulled from the web, then cached locally and displayed. The images are already small (60px square), and I know their size, so I'm using the advice from here suggesting I use setImageURI instead of decoding the bitmap. The class that does the work is a modified version of Fedor's ImageLoader
The code attaches a stub drawable to the ImageView until the desired image is downloaded from the web, then loads the cached file from the sdcard. In Android 2.2 this works just fine. It's fast, and I don't get OOM crashes. On 2.1, though, I get the following error:
CODE:...............
The ImageLoader class is as follows:
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
CODE:.....................
Is related to: http://stackoverflow.com/questions/2307374/need-suggetsion-about-a-mixed-uri-int-id-images-ambient
My problem is:
CODE:......................
Does NOT work. why?
I know that
CODE:........................
work.
But that does NOT solve my problem. because I want to set the image with an uri independenty if this come from a resource or come from the camera ACTION_PICK intent...
I'm using ImageView.setImageURI() to render an image that has been previously downloaded from the Internet. It works fine, but I haven't understood whether the call is blocking or not. In my code, I've implemented a background thread to download the bits, in the meantime a placeholder is rendered, and as soon as a download is complete, setImageURI() is called. This approach is used both for a Gallery with thumbnails and for a single, large rendered with ImageView. The thing is working, but I see that the application freezes for a while when a download has been completed and setImageURI() is called. Which make me wonders whether I'm using it properly.
For the record, I know that the images I'm downloading are larger than I need (at least initially); that is, they are much larger than the thumbnail and the large viewer. Since images, once downloaded, are stored locally forever, I should probably create some smaller-size previews in background and then pass them to Gallery and ImageView? Would that make the UI really more responsive?
I'm having a problem with setImageURI on my ImageView objects. I was using setimageResource(R.drawable.x), which was working fine, but now I'm trying to change over to using URIs so that I can be more flexible about my image source (not constrained to pre-packaged images).
I'm using ImageView.setImageURI(uri), where uri is (for example android.resource://com.example.hellogridview/2130837520, which I created by doing Uri.pars ("android.resource:// com.example.hellogridview/" + R.drawable.x). I took this method from my MediaPlayer, where I created URIs for R.raw wav files from this path.
It's not throwing any errors that I can see, but it's just displaying blank images. The images are ~150px each way and I'm displaying them about half size - would that cause a problem?
I have a view that I am drawing to a bitmap, saving to disk and then putting in an ImageView via setImageURI. However, when the image is displayed in the ImageView it is not being shown at the correct size. It is about 1/3 smaller than it should be. I'm guessing that this is a density issue, but I can't figure out what's going wrong (my emulator is WVGA).
View 2 Replies View Relatedany one guide me how can i display remote image in my layout imageView?
View 1 Replies View RelatedI'm trying to do the following thing without success:
ImageView imgView=(ImageView)findViewById(R.id.imgView); Uri imgUri=Uri.parse("android.resource:// my.package.name/"+R.drawable.image); imageView.setImageURI(imgUri)
I'm stuck, because the imageView just shows nothing. how I can get an Uri (that I can use as ImageView source) from a local resource? which kind of Uri are accepted for the ImageView? IMHO, this topic lacks of documentation.
It has media player controls but none of them seem to work with VLC so in the mean time I'm using Unified Remote to browse my files, then switching over to VLC Remote (hobbyistsoftware version) to control the VLC playback. Would be nice if either.
1. Unified Remote works with VLC Player
2. VLC Remote allows me to browse file WITHOUT VLC player being open on the computer (preferably this one)
Is anyone aware of a way to view the directory structure and files on a remote server or PC? Is there an existing app for this?
View 4 Replies View RelatedI need my app to be able to go to a specified URL and access a file, then insert text at a specific line of said file. Is this at all possible?I
View 1 Replies View Relatedhow to setup a infrared remote control to use with android instead of keyboard or mouse.I thought in lirc but the several ports that I found for android are working to send infrared signals, not to receive them.I was wondering if there is some project or program to allow infrared remote controller manage the android device.
View 1 Replies View RelatedI developed one app it is displaying image and play audio along with the image.for this application i want to get images and audio files from remote server and store those on inside apk
1) i heard about sqllite in mobile.is this database hold image,mp3 files
2) i don't want to store images sd card.
Is there any remote control app that will work on hulu desktop? I have "mycontrol" which works on windows media center, however, it's not 100% compatible with hulu desktop. It hardly can navigate up and down but works fine with right and left buttons. If there's any remote control works perfectly with hulu, that would be just awesome since there are way more videos on hulu than my windows media center.
View 2 Replies View RelatedI tried :
CODE:.............
But i diden't see nothing [simply a void button]
I tried to show a picture in local file system in a imageswitcher. But I could see nothing but a black screen in fact.
Here is my code:
CODE:..............
When I debugged it, it showed me the message "resolveUri failed on bad bitmap uri: file:///data/data/com.Android.Hust.PoliceMap/app_c/2.jpg".
How to solve this problem and show my picture in the Emulator?
I have a very small activity that must show an image.
If picture is not very small (for example 1.12 Mb 2560x1920) it produces out of memory on change screen orientation. I tried getDrawable.setCallback(null) but no luck.
CODE:...................
I want to display pictures into an ImageSwitcher and change image every 3 seconds. I instanciate a Thread that call the setImageURI(URI) and I schedule it every 3 seconds. It does not update the view and I don't know how to do it. If I call the same code that call the setImageURI() from the OnClickListener of the view it works! Do you know why and how can I make it work?
View 3 Replies View RelatedI am running into a very weird thing. I have an ImageView, and when I call setImageURI with an image, it seems to change the size of the image view.
CODE:..............
The default image is 195 x 195, i am trying to set the image to be 200 x 200, after setting the image using setImageURI, i get the dimensions back and it says it's 48 x 48.
I have tried a bunch of different android:scaleType parameters, and I couldn't find anything that worked.
I also tried explicitly setting the size (layout_width="200px") and it seems to work.
added a quick demo video of our upcoming Android Infrared (IR) Remote.Initially it will support a full IR dbase of 300,000+ IR codes, IR learner for any code not in the dbase, Pre-Built GUI so it is simple to setup. Will add rs232, relays, and other tcp options also after initial release.
View 5 Replies View RelatedI have a listlayout with items in it that looks like this:
There is first an ImageView (the light) and then two textViews. All of this inside a TableLayout. (source here: http://code.google.com/p/switchctrl/source/browse/trunk/android/res/layout/device_switch.xml)
I want to have a rotating animation of a loading indicator Ontop of this light when this particular device (light) performs an action or an action is performed on it.
How do I put an animation ontop of this light imageview?
Looking for an App to remote to my desktop.I am trying to see if I can access magicjack on my desktop and make true voip calls.
View 2 Replies View RelatedIs there a syntax to work dynamical in android xml files ?
View 1 Replies View RelatedI have a motorola Droid that has a screen that won't light up. It is still responsive to touch commands (at least I can feel the haptic feedback when I unlock the phone).
I've moved on to a new phone. However, I have the birth of my son on video on the phone(the tasteful portion ). The video is on the internal memory of the phone, yet I'm unable to mount the phone to my PC because I can't see what to touch(I've tried guesstimating where to touch without success). I did save the video to an old pc HD, but that HD went kaput about a year ago.
How to retrieve files from internal memory in which you can't mount the phone by typical means?
I've Set up wowza streaming server in my ubuntu box for RTSP streaming video files. The video gets stream perfectly when I've Totem video player at client side. The same URL or video is failing to work on android device and the application that tries to access that RTSP URL breaks with Mediaplayer error (1,-1).
View 1 Replies View RelatedIts gone- closed by Samsung - but the links to the files still work. Use the cached version through google and you can still get the firmware. Be quick as who knows how long this will work
View 6 Replies View RelatedI'm on Froyo 2.2 (stock ROM) and i have some .apk files on my computer that I want to install, how should I do this since I cant seem to get HTC Sync to work?
View 4 Replies View RelatedI am using eclipse 3.5 with the ADT plugin.when I view layout xml files, i get two tabs in the view the source code view and a graphical view.the graphical view almost never works for any of my layouts.it usually shows "NullPointerException: null" at the top and nothing else. when it does work, it often does not match what i get in the simulator or device.it seems like this thing simply is not ready for prime time; although the idea is very cool.has anyone else had much success with it?
View 5 Replies View RelatedFor some reason My Files folder won't work. It's not showing in my app drawer. I can find it with FolderOrganizer and make a shortcut but I get "error while launching activity" error. Any ideas?
View 2 Replies View RelatedI am having custom Listview. Every row in listview contains image and textview.
After finishing the page I want to execute a thread which will get the reference of all the rows then will extract imgeview and set resource image as lazy loading image.
I just want to know how to get every row's image view so that I can set image resource in it.