F FrankBerra Active Member Licensed User Longtime User Jan 24, 2015 #1 Hi there I am trying to download an image from a remote server and load it with an imageviewer. It downloades the image but i can't see anything. Here some portions of the code: The downloader code is Code: down.Download("http://xxx.xxx.xxx.xxx/media/resized" & Username.text & ".jpg") After download is finished: Code: If Job.JobName="downloaded" Then Msgbox("Photo downloaded" & Job.GetBitmap, "OK") ImageView1.Gravity= Gravity.FILL ImageView1.SetBackgroundImage(Job.GetBitmap) ImageView1.Bitmap=Job.GetBitmap End If Nothing happens on ImageView1....no errors, no images, nothing. The MsgBox says: "Photo downloaded(Bitmap): 250x400" Anyone can help me?
Hi there I am trying to download an image from a remote server and load it with an imageviewer. It downloades the image but i can't see anything. Here some portions of the code: The downloader code is Code: down.Download("http://xxx.xxx.xxx.xxx/media/resized" & Username.text & ".jpg") After download is finished: Code: If Job.JobName="downloaded" Then Msgbox("Photo downloaded" & Job.GetBitmap, "OK") ImageView1.Gravity= Gravity.FILL ImageView1.SetBackgroundImage(Job.GetBitmap) ImageView1.Bitmap=Job.GetBitmap End If Nothing happens on ImageView1....no errors, no images, nothing. The MsgBox says: "Photo downloaded(Bitmap): 250x400" Anyone can help me?
F FrankBerra Active Member Licensed User Longtime User Jan 24, 2015 #2 Ops, sorry, wrong thread. Admins are free to delete or move to B4A section Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Jan 25, 2015 #3 Your code looks correct. Maybe ImageView1 was not created correctly. Upvote 0
F FrankBerra Active Member Licensed User Longtime User Jan 25, 2015 #4 I found the problem. I created the ImageView1 element with the designer and then i initialized it in the Sub Activity_Create with Code: ImageView1.Initialize("") The B4A editor sometimes warns me saying that i shouldn't initialize the object because it is already initialized(?) by the designer. In any case the program runs correctly with no errors. If i comment out the initialization command of ImageView1 everything works fine and the image is correctly loaded into ImageView. That sounds strange for me. Upvote 0
I found the problem. I created the ImageView1 element with the designer and then i initialized it in the Sub Activity_Create with Code: ImageView1.Initialize("") The B4A editor sometimes warns me saying that i shouldn't initialize the object because it is already initialized(?) by the designer. In any case the program runs correctly with no errors. If i comment out the initialization command of ImageView1 everything works fine and the image is correctly loaded into ImageView. That sounds strange for me.
Erel B4X founder Staff member Licensed User Longtime User Jan 25, 2015 #5 FrankBerra said: That sounds strange for me. Click to expand... Not strange at all. There is a reason for this warning. When you initialize the view you are actually creating a new view. So now the variable points to a different ImageView (which is not added to the activity at all). Upvote 0
FrankBerra said: That sounds strange for me. Click to expand... Not strange at all. There is a reason for this warning. When you initialize the view you are actually creating a new view. So now the variable points to a different ImageView (which is not added to the activity at all).