In fact, the only reason not to let the user choose would be if you could make absolutely sure that app was on their device, which you really can't unless you distribute the firmware. If you try to execute the intent and the app isn't available your users will be frustrated with your app's crashing! So at least make sure you catch the exception in the case that the app fails.
kris On Thu, Feb 23, 2012 at 5:11 PM, YuviDroid <[email protected]> wrote: > As Mark suggests it's always good to leave the user a choice. > > However if you really want to start that player you can add to the intent > its package name, so that the filtering is limited to that package. > > intent.setPackage("com.mobo..."); > > > Hope it helps, > Yuvi > > DroidAhead > http://www.droidahead.com > > > On Thu, Feb 23, 2012 at 8:27 PM, Mark Murphy <[email protected]> > wrote: >> >> On Thu, Feb 23, 2012 at 2:15 PM, bob <[email protected]> wrote: >> > I have this code for playing back a movie: >> > >> > Movie_Player.play_movie("/mnt/sdcard/movie1.mpg", this); >> >> Never hardwire paths. Use Environment.getExternalStorageDirectory(). >> >> > public class Movie_Player { >> > >> > public static void play_movie(String file_path, Activity a) >> > { >> > Intent intent = new Intent(); >> > intent.setAction(android.content.Intent.ACTION_VIEW); >> > File file = new File(file_path); >> > intent.setDataAndType(Uri.fromFile(file), "video/*"); >> > a.startActivity(intent); >> > } >> > >> > } >> > >> > The problem is it pops up a list and makes the user choose the movie- >> > player app. Is there an easy >> > way I can tell it to use Mobo Video Player >> > (com.mobo.video.player.arm5)? >> >> Please allow the user to choose whatever video player they want. >> >> -- >> Mark Murphy (a Commons Guy) >> http://commonsware.com | http://github.com/commonsguy >> http://commonsware.com/blog | http://twitter.com/commonsguy >> >> Android Training in DC: http://marakana.com/training/android/ >> >> -- >> 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 > > > > > -- > YuviDroid > Check out Launch-X (a widget to quickly access your favorite apps and > contacts!) > http://android.yuvalsharon.net > > -- > 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 -- 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

