Hi
Can we download apk file which is in internet using android application
I downloaded the pdf using the following program
try {

            URL url = new URL(imageURL);
            File file = new File(fileName);
            long startTime = System.currentTimeMillis();

                /* Open a connection to that URL. */

             URLConnection ucon = url.openConnection();
              InputStream is = ucon.getInputStream();
             BufferedInputStream bis = new BufferedInputStream(is);
            ByteArrayBuffer baf = new ByteArrayBuffer(50);
            int current = 0;
            while ((current = bis.read()) != -1) {

                baf.append((byte) current);

            }

            /* Convert the Bytes read to a String. */
            FileOutputStream fos = context.openFileOutput(fileName,
context.MODE_WORLD_WRITEABLE);
            fos.write(baf.toByteArray());

            fos.close();


        } catch (IOException e) {

            Log.d("ImageManager", "Error: " + e);

        }

Now i used the same program to download apk but
When iam trying to install this apk file it is giving some error as follows
EOCD not found, not Zip
file 'myfile.apk' is not a valid zip file

Any help please

-- 
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