Re: [android-developers] Intent choosing

2012-02-23 Thread Kristopher Micinski
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  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 
> wrote:
>>
>> On Thu, Feb 23, 2012 at 2:15 PM, bob  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 android-developers@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-developers+unsubscr...@googlegroups.com
>> 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 android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Intent choosing

2012-02-23 Thread YuviDroid
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 wrote:

> On Thu, Feb 23, 2012 at 2:15 PM, bob  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 android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Intent choosing

2012-02-23 Thread Mark Murphy
On Thu, Feb 23, 2012 at 2:15 PM, bob  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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Intent choosing

2012-02-23 Thread bob
I have this code for playing back a movie:


Movie_Player.play_movie("/mnt/sdcard/movie1.mpg", this);

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)?

Thanks.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en