Hi All,
I am working on file explorer application in which I cannot open any
file.I am using following code to open the file which I got from
anddev.org.
OnClickListener okButtonListener = new OnClickListener(){
// @Override
public void onClick(DialogInterface arg0, int arg1) {
// Lets start an intent to View the file, that
was clicked...
Intent myIntent = new Intent
(android.content.Intent.ACTION_VIEW,Uri.parse("file://" +
aDirectory.getAbsolutePath()));
startActivity(myIntent);
}
};
OnClickListener cancelButtonListener = new OnClickListener
(){
// @Override
public void onClick(DialogInterface arg0, int arg1) {
// Do nothing
}
};
new AlertDialog.Builder(this)
.setTitle("Question")
.setMessage("Do you want to open that file?\n"+
aDirectory.getName())
.setPositiveButton("OK", okButtonListener)
.setNegativeButton("Cancel", cancelButtonListener)
.show();
But I am getting following exception after clicking on any file.
11-20 10:26:51.290: INFO/ActivityManager(50): Starting activity:
Intent { action=android.intent.action.VIEW data=file:///sdcard/1.txt }
11-20 10:26:51.299: WARN/System.err(218):
android.content.ActivityNotFoundException: No Activity found to handle
Intent { action=android.intent.action.VIEW data=file:///sdcard/1.txt }
11-20 10:26:51.369: WARN/System.err(218): at
android.app.Instrumentation.checkStartActivityResult
(Instrumentation.java:1472)
11-20 10:26:51.369: WARN/System.err(218): at
android.app.Instrumentation.execStartActivity(Instrumentation.java:
1442)
11-20 10:26:51.380: WARN/System.err(218): at
android.app.Activity.startActivityForResult(Activity.java:2528)
11-20 10:26:51.388: WARN/System.err(218): at
android.app.Activity.startActivity(Activity.java:2572)
11-20 10:26:51.409: WARN/System.err(218): at
android.file.FileExplorer.onListItemClick(FileExplorer.java:171)
11-20 10:26:51.409: WARN/System.err(218): at
android.app.ListActivity$2.onItemClick(ListActivity.java:312)
11-20 10:26:51.409: WARN/System.err(218): at
android.widget.AdapterView.performItemClick(AdapterView.java:283)
11-20 10:26:51.409: WARN/System.err(218): at
android.widget.ListView.performItemClick(ListView.java:3049)
11-20 10:26:51.420: WARN/System.err(218): at
android.widget.AbsListView$PerformClick.run(AbsListView.java:1415)
Is there any permission is needed to open any file or any resources
are required??
Plese give ur suggestions as soon as possible.
Thanks in advance....
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---