Download a pdf file using Android
Résolu
Hichamisto
Messages postés
61
Statut
Membre
-
Hichamisto Messages postés 61 Statut Membre -
Hichamisto Messages postés 61 Statut Membre -
I want to download a pdf file from my computer (server) to an Android device using Android language .
I tried to many programmes but it doesn't work.
Please Help.
I tried to many programmes but it doesn't work.
Please Help.
A voir également:
- Download a pdf file using Android
- Lire le coran en français pdf - Télécharger - Histoire & Religion
- Android recovery - Guide
- Host file - Guide
- .Bin file - Guide
- Jouer a pokemon sur android - Guide
4 réponses
You can easiliy copy pdf file from your pc to an android device using USB and use this app > http://updatedinfo.org/ezpdf-reader-multimedia-pdf-v2-5-5-0-apk/ to read the pdf file...
thank you for your response Chirstianbale ,
but i think you misunderstood me. i want to programme with a Android language how to download a PDF file from the internet or my server fo example
but i think you misunderstood me. i want to programme with a Android language how to download a PDF file from the internet or my server fo example
j'ai oublié de partager avec vous la solution que j'ai trouvé
elle marche bien :
telecharger un fichier à partir d'un Android
public void Download (){
String extStorageDirectory = Environment.getExternalStorageDirectory().toString();
File folder = new File(extStorageDirectory, "PDF");
folder.mkdir();
File file = new File(folder, "nomFichier.pdf");
try {
file.createNewFile();
} catch (IOException e1) {
e1.printStackTrace();
}
Downloader.DownloadFile("http://adresse fichier/fichier.pdf", file);
Toast.makeText(this, "download finished", Toast.LENGTH_SHORT).show();
}
elle marche bien :
telecharger un fichier à partir d'un Android
public void Download (){
String extStorageDirectory = Environment.getExternalStorageDirectory().toString();
File folder = new File(extStorageDirectory, "PDF");
folder.mkdir();
File file = new File(folder, "nomFichier.pdf");
try {
file.createNewFile();
} catch (IOException e1) {
e1.printStackTrace();
}
Downloader.DownloadFile("http://adresse fichier/fichier.pdf", file);
Toast.makeText(this, "download finished", Toast.LENGTH_SHORT).show();
}
et pour télécharger un fichier à partir d'un client Java ou J2EE c'est pareil
try{
URL url = new URL("http://adresse fichier/fichier.pdf");
InputStream in = url.openStream();
FileOutputStream fos=null;
File doc = new File("c:/Rapports");
if(!doc.exists())
doc.mkdir();
fos = new FileOutputStream(new File("c:/newFile.pdf"));
int length = -1;
byte[] buffer = new byte[1024];
while ((length = in.read(buffer)) > -1) {
fos.write(buffer, 0, length);
}
fos.close();
in.close();
}
catch (Exception e) {
e.printStackTrace();
}
try{
URL url = new URL("http://adresse fichier/fichier.pdf");
InputStream in = url.openStream();
FileOutputStream fos=null;
File doc = new File("c:/Rapports");
if(!doc.exists())
doc.mkdir();
fos = new FileOutputStream(new File("c:/newFile.pdf"));
int length = -1;
byte[] buffer = new byte[1024];
while ((length = in.read(buffer)) > -1) {
fos.write(buffer, 0, length);
}
fos.close();
in.close();
}
catch (Exception e) {
e.printStackTrace();
}