Android :: Why Would ImageView.setImageURI() Work In 2.2 But Not 2.1
Sep 15, 2010
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:.....................
View 1 Replies
Feb 22, 2010
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...
View 1 Replies
View Related
Jun 19, 2010
Can you make an ImageView load an image from a remote server through the ImageView.setImageURI(URI uri) method?
View 2 Replies
View Related
Sep 14, 2010
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?
View 2 Replies
View Related
Aug 11, 2009
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?
View 2 Replies
View Related
Feb 17, 2010
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 Related
Feb 23, 2010
I'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.
View 8 Replies
View Related
Oct 6, 2010
I tried :
CODE:.............
But i diden't see nothing [simply a void button]
View 1 Replies
View Related
Apr 1, 2009
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?
View 4 Replies
View Related
Jun 11, 2010
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:...................
View 2 Replies
View Related
Nov 21, 2010
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 Related
Sep 15, 2010
I 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.
View 2 Replies
View Related
Jun 15, 2010
I 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?
View 1 Replies
View Related
Nov 26, 2009
I 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.
View 1 Replies
View Related
Nov 19, 2010
So here is my question. I am trying to use an online thumbnail. I can have looked around and have not found too much data on this. Can some provide me the simplest way to do this. Also If i implement a simpleExpandableListAdapter which is designed as a textView Adapter is there a way to force the image in?
View 4 Replies
View Related
May 23, 2009
I have a ImageView with a Picture in it. When I touch the Picture through the TouchScreen, how can i get the ColorCode (eg. 0xff0033933) from the x/y Coordinate I clicked?
Something like: onTouch.GetColorCode (from the pixel bellow my finger)
View 2 Replies
View Related
Apr 20, 2010
how can I implement an imageview that has touch-sensitive hotspots so that when the user touches one, a dialog or something similar appears.
View 2 Replies
View Related
Jan 11, 2010
I have an ListActivity that I wan't to add a logo to at the top above the list but I'm unsuccessful. This is what my layout looks like at the moment.
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent"> <ImageView android:id="@+id/logo" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <ListView android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="fill_parent" android:drawSelectorOnTop="false"> </ListView> <TextView android:id="@+id/empty" android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="@string/list_empty" /> </LinearLayout>
Then I add an drawable to the ImageView logo in onCreate. I've managed to show either the ListView or the ImageView but never both of them in the same LinearLayout. Is it possible to add other views together with a ListView?
View 3 Replies
View Related
Apr 7, 2010
Question on an oddity I am seeing.
I have an ImageView that I am using to display a splash screen for a couple of seconds:
CODE:..................
View 3 Replies
View Related
Nov 18, 2009
I'm using Android 1.6.
I'm wondering if there's a simple way to put text on top of an ImageView element. Specifically, I'd like to have text overlayed on top of a rectangle filled with a color gradient.
I have the following in my XML layout:
CODE:................
But the text specified in android:text doesn't show up in my view.
Any thoughts on how to overlay text on top of an image?
There might be a simpler way to do this, so I'm open to alternative suggestions but I haven't been able to find anything via the google.
View 3 Replies
View Related
Mar 19, 2010
How can I Zoom In/Out with ImageView.
View 2 Replies
View Related
Aug 3, 2010
How do you get the alpha of an ImageView? You can setAlpha, but I can find no way to retrieve it afterwords.
View 2 Replies
View Related
Sep 4, 2009
I want to overlap two imageView. I tried View.offsetLeftAndRight, but it does not work.
My code is as below:
code:.....................
View 3 Replies
View Related
Apr 4, 2009
I'm making a little card game in order to learn the more interesting stuff of the UI and I have a question:
I want to show 5 cards on the table, for that i have made 5 imageviews in the xml:
CODE:..................
As you might notice here, i'm doing them with an overlap since the uer should be able to pick up the last card and should therefore see it, but the other 4 are just so he'll know what was thrown lastly. my problem is: in the begining the imageviews have no src, but once i give them an image source
using CODE:..............
I dont know how i can undo it - i can't set the imageResourceId to null since it is an int type so is there something like -1 or some constant value that means null? i know about visibility, i'd rather not use it here unless i really have to, since it'll require a bunch or refactoring that i prefer to avoid...
View 5 Replies
View Related
Feb 28, 2010
How to make an image clickable?
I mean, I tried to use onClickListener and onClick but nothing seems to work....
OnClickListener is always underlined and the error says: "The type new DialogInterface.OnClickListener(){} must implement the inherited abstract method DialogInterface.OnClickListener.onClick(DialogInterface, int)"
View 4 Replies
View Related
Feb 27, 2010
I want to show a graphic inside my activity. A graphic thats from the www. Just like http://www.google.de/logos/olympics10-sskating-hp.png.
Wenn, in general I would download the graphic, convert it (maybe with photoshop or something), rename it (if neccassary) and copy it to my drawable folder. Then I can use its id inside my xml layout.
Now I want this procedure dynamically.
Which is the quickest way to do so?
I dont want to use WebView for this...
View 3 Replies
View Related
Nov 28, 2009
I want to read image from web ex. http://www.abc.com/image1.jpg and dynamic set to imageview component.
View 1 Replies
View Related
Mar 30, 2010
I have a layout with an ImageView defined like:
CODE:............
Now I just want to set the imageview to be a static color, like red or green.
I'm trying:
CODE:.........
The imageview is just empty though, no color. The 45dip space is being used up though. What do I need to do to get the color to be rendered?
View 1 Replies
View Related
Jun 3, 2010
I want to set the LayoutParams for an ImageView but cant seem to find out the proper way to do it.
I can only find documentation in the API for the various ViewGroups, but not an ImageView. Yet the ImageView seems to have this functionality.
This code doesn't work...myImageView.setLayoutParams(new ImageView.LayoutParams(30,30));
How do I do it?
View 1 Replies
View Related
Aug 3, 2010
How can I do this? There's a setAlpha but no getAlpha.
View 2 Replies
View Related