below code download file from url :
Intent intent=new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com/Erfan/update.apk"));
That isn't how you download something. That's how you launch an activity that claims to read websites, and tell it to open that website. If you want to download something, either use an HTTP connection of your own or use DownloadManager.