package com.exercise.AndroidReadPDF;
import java.io.File;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
public class AndroidReadPDFActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
String path = "/sdcard/AndroidUsersGuide-2.3.4.pdf";
File targetFile = new File(path);
Uri targetUri = Uri.fromFile(targetFile);
Intent intent;
intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(targetUri, "application/pdf");
startActivity(intent);
}
}
Thank you for reading this article View PDF file by starting activity with intent of ACTION_VIEW With URL https://x-tutorials.blogspot.com/2011/08/view-pdf-file-by-starting-activity-with.html. Also a time to read the other articles.
0 comments:
Write your comment for this article View PDF file by starting activity with intent of ACTION_VIEW above!