SDカードに「test.pdf」という名前のpdfファイルが保存されています。次のコードを使用して、アプリケーションでこのファイルを開きました。
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath() +"/"+ "test.pdf");
Intent target = new Intent(Intent.ACTION_VIEW);
target.setDataAndType(Uri.fromFile(file),"application/pdf");
target.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
Intent intent = Intent.createChooser(target, "Open File");
try {
startActivity(intent);
} catch (ActivityNotFoundException e) {
// Instruct the user to install a PDF reader here, or something
Toast.makeText(getApplicationContext(), "not found", Toast.LENGTH_SHORT).show();
}
}
});
アプリケーション内に PDF が表示されます。今、共有プリンターを使用してこの PDF ファイルを印刷したいと考えています。どうやってやるの?