Question

I am using the AndroidQuery's way of handling images in saving then to sd card. But the dialog is not showing for some reason. The images are properly saved in sd card, only the dialog is the problem.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="100dip" 
    >

    <ProgressBar                
        android:layout_width="15dip"       
        android:layout_height="15dip"
        android:id="@+id/progress" 
        android:layout_centerInParent="true"
        />

    <ImageView
        android:id="@+id/image"       
        android:layout_width="fill_parent"       
        android:layout_height="75dip"
        />

</RelativeLayout>

Code:

String url = path;
File ext = Environment.getExternalStorageDirectory();
File target = new File(ext, "Folder/Folder/" + pathName + ".jpg");

laQuery.progress(R.id.progress).download(url, target, new AjaxCallback<File>() {

    public void callback(String url, File file, AjaxStatus status) {

        if (file != null) {

            // Log.d("File:" + file.length() + ":" + file, status);
            Log.i("Aquery not null", "File:" + file.length());
            Log.i("Aquery not null", "File:" + file);
            Log.i("Aquery not null", "File:" + status);
        } else {
            Log.d("Failed", "" + status);
        }
    }

});
Was it helpful?

Solution

RelativeLayout children are drawn in the order they are declared in. So your ProgressBar is underneath the ImageView and Android Query doesn't have a reference to the ImageView to control its visibility.

Switch the order of their declarations to make the progress bar be on top.


Update: Checked the source and download() requests don't support the progress bar, only image() requests do. You'll have to set the progress bar to visible yourself and hide it in callback().

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top