Android Tutorial ImageDownloader - The simple way to download images

Status
Not open for further replies.

lock255

Well-Known Member
Licensed User
Longtime User
In practice, when would that be in error would show ImageView1 an image contained locally.
The type to show an image prepared by me saying "Page not available", so as to make more cute dialogue with the user.
 

lock255

Well-Known Member
Licensed User
Longtime User
Yes I understand, but have not uploaded an image locally, would you suggest me a simple tutorial to do that?
 

stanks

Active Member
Licensed User
Longtime User
i moved part of code from activity resume to service_create, but what to do with activity_pause? do i need code in activity_pause?
 
Last edited:

Douglas Farias

Expert
Licensed User
Longtime User
Erel how can i know when the imageview have the photo or no ?

i make this

B4X:
    If kv.GetSimple("imgcrop") = "3" Then
    links.Put(imvImage, "http://localhost/clickfight/UsersImages/"&userid&"/MeuPerfil/NaoEnviadas/FinalPictures/"&"3.jpg")
    CallSubDelayed2(ImageDownloader, "Download", links)
    ProgressDialogHide

my progressdialog close but the image dont show in the same time show me 2 3 seconds later
how can i know if the image downloaded is on imageview ProgressDialogHide
 

Douglas Farias

Expert
Licensed User
Longtime User
done *-* when the image is realy visible close my progressdialog

this is the code from downloaderimage

B4X:
Sub JobDone(Job As HttpJob)
    ongoingTasks.Remove(Job.JobName)
    If Job.Success Then
        Dim bmp As Bitmap = Job.GetBitmap
        cache.Put(Job.JobName, bmp)
        If tasks.IsInitialized Then
            For i = 0 To tasks.Size - 1
                Dim link As String = tasks.GetValueAt(i)
                If link = Job.JobName Then
                    Dim iv As ImageView = tasks.GetKeyAt(i)
                    iv.SetBackgroundImage(bmp)
                    ProgressDialogHide
                End If
            Next
        End If
    Else
    ProgressDialogHide
        Log("Error downloading image: " & Job.JobName & CRLF & Job.ErrorMessage)
    End If
    Job.Release
End Sub
 

eSolution

Member
Licensed User
Longtime User
With Image Downloader 2 - I have a problem when I try to start the app in rapid debug mode on my device, I get this error: "
pkg: /data/local/tmp/1_RAPID_DEBUG.apk
Failure [INSTALL_FAILED_VERSION_DOWNGRADE]

Restarting ADB Server may solve this problem.
"
I have restarted ADB several times, other projects compile ok and run ok ... I have tried all android platforms above 14 (14 to L) and the error is present on all... I use Java 1.8.05 , My Android SDK is up to date (last update made 30 min ago) and my B4A is the last update 3.82

Any fix for this kind of behavior?

Image Downloader 1 works fine


EDIT: I have found the problem: the example use the 1.0 CustomListView, after an update to 1.1 it works like a charm
 
Last edited:

bluedude

Well-Known Member
Licensed User
Longtime User
I use this solution but my images in an imageview never get the correct gravity. Does setbackground actually use a Gravity.fill setting? My images always get cut off at the sides a little.

Tried to use a resizeimage solution but that reduces the quality too much.

Should I use loadbitmap instead?
 

bluedude

Well-Known Member
Licensed User
Longtime User
Hi,

I already do that but it does not work as expected. Is there another solution to make images (company logos) always scale perfectly?

On iPhone we use a small PDF viewer, this works extremely well.
 

bluedude

Well-Known Member
Licensed User
Longtime User
Found the issue, I set a panel background with a holo bg panel, this one cuts off the image on the sides.
 

tpakis

Active Member
Licensed User
Longtime User
I'm trying to optimize the memory allocation, cause i am having problems when i show a large list of images. In the service there is a cache map where the links and the bitmaps are stored, and in the main activity there is the clv with the loaded images. What is causing the problem, the cache or the clv? Should i try to have less images loaded, or to erase the cache?
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…