Используя этот код:Открытие и просмотр PDF в моем приложении
try {
URL url = new URL(aurl[0]);
URLConnection conexion = url.openConnection();
conexion.connect();
int lenghtOfFile = conexion.getContentLength();
Log.d("ANDRO_ASYNC", "Lenght of file: " + lenghtOfFile);
InputStream input = new BufferedInputStream(url.openStream());
FileOutputStream fos = openFileOutput("try.pdf", Context.MODE_PRIVATE);
//PARA DESCARGARLO EN SD//
// OutputStream output = new FileOutputStream("/sdcard/prueba.pdf");
byte data[] = new byte[1024];
long total = 0;
while ((count = input.read(data)) != -1) {
total += count;
publishProgress(""+(int)((total*100)/lenghtOfFile));
fos.write(data, 0, count);
}
fos.flush();
fos.close();
input.close();
} catch (Exception e) {}
return null;
Я держу в приложении в формате PDF 8 Мб размер. Я использовал несколько кодов, чтобы попытаться открыть его и просмотреть, но не могу найти способ.
Любые предложения?
http://stackoverflow.com/q/10299839/1289716 – MAC
проверить ссылку http://stackoverflow.com/questions/4468621/android-load-pdf-pdf-viewer –
@ gtumca-MAC, я пробую этот код, и я не могу работать – jlopez