アンドロイドアプリを作りました。拡張可能なリストを作成しました。子をクリックすると PDF が開きます。PDF が開いていません。no_application_found の内容であるメッセージ (「PDF を開けません」) が表示されます。PDFを開くためのコードは次のとおりです。
public boolean onChildClick (
ExpandableListView parent,
View v,
int groupPosition,
int childPosition,
long id) {
Log.d( LOG_TAG, "onChildClick: " + childPosition );
File file = new File("http://www.ratt.ro/grafice/e2-a.pdf");
Uri path = Uri.fromFile(file);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.setDataAndType(path, getString(R.string.application_type));
try
{
startActivity(intent);
}
catch (ActivityNotFoundException e)
{
Toast.makeText(ElistCBox.this,
getString(R.string.no_application_found),
Toast.LENGTH_SHORT).show();
}
return false;
}