الإخوة الأفاضل كيف يمكنني فتح ملف pdfعلى شاشة الجهاز من خلال الضغط على صورة jpg
جزاكم الله ألف خير
الإخوة الأفاضل كيف يمكنني فتح ملف pdfعلى شاشة الجهاز من خلال الضغط على صورة jpg
جزاكم الله ألف خير
السلام عليكم ورحمة الله
طبعاً لن أناقش كيفية عمل الظغط على الصورة .... click Listener ... android:onClick="openPdf"
إن كان الملف في الذاكرة الخارجية للجهاز (SCARD )
private void openPdf() {
File file = new File("/sdcard/test.pdf");
Uri path = Uri.fromFile(file);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.setAction(Intent.ACTION_VIEW);
intent.setData(path);
intent.setType("application/pdf");
try {
startActivity(intent);
} catch (ActivityNotFoundException e) {
Toast.makeText(getActivity(), "No application found",
Toast.LENGTH_SHORT).show();
}
}حفظك الله و رعاك