ImageView Refresh image from internet periodicly

All your problems with Audio, Video and Images.

Re: ImageView Refresh image from internet periodicly

Postby jonbonazza » Wed Sep 01, 2010 2:45 pm

That code is just to give you an idea of how to allow the image to refresh every two seconds. It doesn't even implement the buttons. Also, the image needs to be on the website at the URL you specified in the code. Also, the image needs to have the name that you set to the imageName variable.

One thing I did notice is that in in your handler, you have:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. final String path = "/sdcard/download" + imageName;
  2.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


That is a major problem because you don;t have a '/' between the path and the imageName. I believe this was my mistake, but you have two choices here:

1) You can declare the class-wide constant like so:
Code: Select all
public static final String imageName = "current.jpg"

and change path string variable like so:
Code: Select all
final String path = "/sdcard/download/" + imageName;

or

2) You can directly just directly add the image name to the path string like so:
[code]
final String path = "/sdcard/download/current.jpg";


It's up to you.

I didn't test all of this code, but most of it is copy/pasted from an old project I did and it is already in the market so I know it works. I just changed some of it to fit your needs and made a few typos.

As for the buttons, I am not going to write this code for you, but this will give you a very good start as to where to go.
jonbonazza
Master Developer
Master Developer
 
Posts: 665
Joined: Thu Jul 15, 2010 2:58 pm
Location: WV USA

Top

Re: ImageView Refresh image from internet periodicly

Postby dujmovic.antonio » Wed Sep 01, 2010 6:35 pm

I've managed to get it to work. I'll post my solution here in this thread.
Thank you guys for your help!
dujmovic.antonio
Junior Developer
Junior Developer
 
Posts: 10
Joined: Fri Aug 27, 2010 12:27 pm

Re: ImageView Refresh image from internet periodicly

Postby dujmovic.antonio » Wed Sep 01, 2010 6:39 pm

jonbonazza wrote:That code is just to give you an idea of how to allow the image to refresh every two seconds. It doesn't even implement the buttons. Also, the image needs to be on the website at the URL you specified in the code. Also, the image needs to have the name that you set to the imageName variable.

One thing I did notice is that in in your handler, you have:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. final String path = "/sdcard/download" + imageName;
  2.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


That is a major problem because you don;t have a '/' between the path and the imageName. I believe this was my mistake, but you have two choices here:

1) You can declare the class-wide constant like so:
Code: Select all
public static final String imageName = "current.jpg"

and change path string variable like so:
Code: Select all
final String path = "/sdcard/download/" + imageName;

or

2) You can directly just directly add the image name to the path string like so:
[code]
final String path = "/sdcard/download/current.jpg";


It's up to you.

I didn't test all of this code, but most of it is copy/pasted from an old project I did and it is already in the market so I know it works. I just changed some of it to fit your needs and made a few typos.

As for the buttons, I am not going to write this code for you, but this will give you a very good start as to where to go.



I didn't see your replay. I have managed to implement the buttons and everything I needed, so you have been of great help. If you could just tell me some recommendations for learning, that i've asked you earlier.
dujmovic.antonio
Junior Developer
Junior Developer
 
Posts: 10
Joined: Fri Aug 27, 2010 12:27 pm

Top
Previous

Return to Multimedia Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 7 guests