views:

60

answers:

1

Hey Guys,

I'm wondering..

1)is it possible to set an imageview's resource to the URL location of an image?

2)is there a way of setting the x,y co-ords of where on the screen to draw the imageview?

3)How would I run a check to see if the space is taken up by another Imageview (must specifically be an imageview)

4) How would I make the Imageview "clickable" e.g if the user clicks the image it'll do something?

5) How would I dynamically create imageviews? E.g if a condition is true make another imageview

Perhaps I'm going about this wrong so I'll explain better what I'm looking to do.. basically I want to draw images on the screen which are located at URL's. I want to display N amount of images (There will be conditions which will decide how many images I'm displaying, so it'll have to be dynamically created) each image should take up approx 50x50 screen space. There will be other conditions to where the image should be displayed.. If an image exists at a certain co-ord it shouldn't draw over it, when the user clicks the image something else should happen.

Hopefully this makes things clearer.

Thanks.

+2  A: 
  1. Not directly. You can download image afer program was started, then convert it to Drawable and display on screen. But you cannot assume user always enables data transfer, so often image won't be downloaded at all.

  2. Yes, but much better is to use Layouts - different handsets have different screen resolutions and desinty.

  3. No simple answer - it depends, how you prepare and display screen contents.

  4.     ((ImageView)view.findViewById(R.id.imageid)).setOnClickListener(new OnClickListener()
        {
            public void onClick(View v)
            {
               //something
            }
        });     
    
  5. It sounds like you don't need ImageView (the graphics component used to place image in various layouts) itself, but rather some kind of canvas. Anyway, see:

tomash