Hi, I'm trying to make my app display a download progress for bigger files.
But I can't figure how to make it work properly.The data is an image I plan
to set up as wallpaper

Does anyone has an example of this?

Thanks!!



         URL url = new URL(address1);

        HttpURLConnection uc = (HttpURLConnection) url.openConnection();

        InputStream is = (InputStream)uc.getContent();

        int progress = 0;



        int leng = uc.getContentLength();

        byte[] bytes = new byte[20480];

        byte[] content = new byte[leng];



        //starts reading the file

        int readBytes = is.read(bytes);

        while (readBytes > 0) {



        readBytes = is.read(bytes);



        progress += readBytes;

        Log.d("d", progress +"");

        }

        ByteArrayInputStream bis = new ByteArrayInputStream(content);





        getApplicationContext().setWallpaper(bis);




Ivan Soto Fernandez
Web Developer
http://ivansotof.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to