android,如何用代码的形式下载一个apk的应用程序呢?求代码和思路???

解决方案 »

  1.   

    URL Url = new URL(url);    
        URLConnection conn = Url.openConnection();       
        conn.connect();          
        InputStream is = conn.getInputStream();   
        
        FileOutputStream FOS = new FileOutputStream(path + this.FileName);  
        // 创建写入文件内存流,通过此流向目标写文件        
        byte buf[] = new byte[1024];         
        int numread;         
        while ((numread = is.read(buf)) != -1) {   
            FOS.write(buf, 0, numread);       
           
            }                 
        try {          
            is.close();     
            } catch (Exception ex) {   
                ;     
                }