क्या किसी को भी एंड्रॉइड में पीडीएफ फाइल को खोलने का विचार है?संपत्ति फ़ोल्डर से एंड्रॉइड में पीडीएफ फाइल कैसे खोलें?
public class SampleActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
CopyReadAssets();
}
private void CopyReadAssets() {
AssetManager assetManager = getAssets();
InputStream in = null;
OutputStream out = null;
File file = new File(getFilesDir(), "git.pdf");
try {
in = assetManager.open("git.pdf");
out = openFileOutput(file.getName(), Context.MODE_WORLD_READABLE);
copyFile(in, out);
in.close();
in = null;
out.flush();
out.close();
out = null;
} catch (Exception e) {
Log.e("tag", e.getMessage());
}
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(
Uri.parse("file://" + getFilesDir() + "/git.pdf"),
"application/pdf");
startActivity(intent);
}
private void copyFile(InputStream in, OutputStream out) throws IOException {
byte[] buffer = new byte[1024];
int read;
while ((read = in.read(buffer)) != -1) {
out.write(buffer, 0, read);
}
}
}
आप इस लिंक पर देख सकते हैं: मेरे कोड इस इस लग रहा है http://stackoverflow.com/questions/6491210/how-to-open-a-pdf-stored-either-in-res-raw-or-assets-folder – omi0301
की जाँच इस http: // stackoverflow.com/questions/6491210/how-to-open-a-pdf-stored-either-in-res-raw-or-assets- फ़ोल्डर – Aamirkhan
@sai कृपया निर्दिष्ट करें कि आप किस समस्या का सामना कर रहे हैं, यानी कोई अपवाद/त्रुटि, या उपलब्ध पीडीएफ दर्शक सूची की ऐप प्रदर्शित सूची? –