Last active
May 17, 2018 08:01
-
-
Save bulentsiyah/fa9835d42cf5adca735800b7fc679331 to your computer and use it in GitHub Desktop.
Open pdf files located inside the App (raw folder) Android ---http://www.bulentsiyah.com/open-pdf-files-located-inside-the-app-raw-folder-android/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Open pdf files located inside the App (raw folder) Android | |
try { | |
copyFile(getResources().openRawResource(R.raw.yardim), | |
new FileOutputStream(new File(dirpicture, "yardim_copy.pdf"))); | |
File pdfFile = new File(dirpicture, "yardim_copy.pdf"); | |
Uri path = Uri.fromFile(pdfFile); | |
Intent intent = new Intent(Intent.ACTION_VIEW); | |
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); | |
intent.setDataAndType(path, "application/pdf"); | |
startActivity(intent); | |
} catch (Exception ex) { | |
ex.toString(); | |
} | |
public static String dirpicture = Environment.getExternalStorageDirectory()+ "/Bulenttes/"; | |
private void copyFile(InputStream in, OutputStream out) throws IOException { try { byte[] buffer = new byte[1024]; int read; while((read = in.read(buffer)) != -1){ out.write(buffer, 0, read); } }catch(Exception exp){ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment