startActivity on "file://" links crashes

Put your problem here if it does not fit any of the other categories.

startActivity on "file://" links crashes

Postby POMATu » Tue Apr 12, 2011 5:45 pm

Hi. I am trying to create program that simply opens file on sdcard. I tried opening mp3, mp4, and apk - the code bellow always crashes unexpectedly.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.          String _path = "file:///sdcard/1.apk";
  3.          Uri outputFileUri = Uri.parse(_path);
  4.         Intent intent = new Intent();
  5.         intent.setAction(Intent.ACTION_VIEW);
  6.         intent.setData(outputFileUri);  
  8.           startActivity(intent);
Parsed in 0.010 seconds, using GeSHi

Market links also crashes. But when I set _path="" - browser opens normally. How can I make this code work?
Posts: 2
Joined: Tue Apr 12, 2011 5:39 pm


Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 7 guests