I want to open a pdf file from the assets folder by clicking a button. Tried the below code but it's not working. Please suggest some solutions.
btn_help.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String uriPath = "file:///android_asset/Guide.pdf";
Uri uri = Uri.parse(uriPath);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(uri, "application/pdf");
startActivity(intent);
}
});
I believe you can use PDF Viewer library .
Through this library you can use pdfView.fromAsset()
builder.
I hope this may solve your issue.
Happy Coding
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.