funnylookinhat,
this is how I was able to allow the user to open the Gallery to look
at pics (I'm not using startActivityForResult(), so you might need to
change the code):
Intent i = new Intent();
i.setAction(Intent.ACTION_VIEW);
i.setComponent(new ComponentName("com.android.gallery",
"com.android.camera.ImageGallery"));
i.setData(Uri.parse("content://media/internal/images/media"));
startActivity(i);
On Dec 10, 10:39 am, funnylookinhat <[email protected]> wrote:
> I have a similiar problem - however I only want the user to be able to
> use Gallery rather than any other application that responds to
> Intent.ACTION_GET_CONTENT - Is there a way to do this?
>
> On Dec 10, 2:30 am, Tom <[email protected]> wrote:
>
>
>
> > I forgot in the same class, I start intents :
>
> > // Pick contact information from contacts list
> > Intent i = new Intent(Intent.ACTION_GET_CONTENT);
> > i.setType("image/*");
> > startActivityForResult(i, PICK_IMAGE);
>
> > // Pick image from gallery
> > Intent intent = new Intent(Intent.ACTION_PICK,
> > People.CONTENT_URI);
> > startActivityForResult(intent, PICK_CONTACT);
>
> > On 10 déc, 10:23, Tom <[email protected]> wrote:
>
> > > This is the solution :
>
> > > in the activity class, I change onActivityResult method to handle
> > > picking contact and picking image fromgallery.
>
> > > private static final int PICK_CONTACT = 0;
> > > private static final int PICK_IMAGE = 1;
>
> > > @Override
> > > public void onActivityResult(int reqCode, int resultCode, Intent
> > > data) {
> > > super.onActivityResult(reqCode, resultCode, data);
>
> > > switch (reqCode) {
> > > case (PICK_CONTACT):
> > > if (resultCode == Activity.RESULT_OK) {
> > > Uri contactData = data.getData();
> > > Cursor c = managedQuery(contactData, null, null,
> > > null, null);
> > > if (c.moveToFirst()) {
> > > Bitmap photo = People.loadContactPhoto(this,
> > > contactData, DEFAULT_IMAGE, null);
> > > }
> > > }
> > > break;
>
> > > case (PICK_IMAGE):
> > > if (resultCode == Activity.RESULT_OK)
> > > {
> > > // the image is accessible via :
> > > data.getData();
> > > }
> > > break;
> > > }
> > > }
>
> > > On 1 déc, 17:48, Tom <[email protected]> wrote:
>
> > > > Thanks for your answer both of you...
>
> > > > I'm going to look at this now...
>
> > > > Best regards
> > > > Tom
>
> > > > On 1 déc, 16:22, Carmen Delessio <[email protected]> wrote:
>
> > > > > Start the activity with startActivityForResult. Then handle the
> > > > > returned
> > > > > data in onActivityResult.
> > > > > The source below is how I do it. There should be enough here to get
> > > > > the
> > > > > photo data.
> > > > > Carmen
> > > > > --
> > > > > Carmenhttp://www.twitter.com/CarmenDelessiohttp://www.talkingandroid.comhtt...
>
> > > > > Call the Intent somewhere in your activity using
> > > > > startActivityForResult:
> > > > > Intent i = new Intent(Intent.ACTION_GET_CONTENT);
> > > > > i.setType("image/*");
> > > > > startActivityForResult(i,4); // activity id is 4
>
> > > > > // handle the activity
> > > > > // look at documentation for AssetFileDescriptor. That is how I
> > > > > ultimately
> > > > > got the photo
> > > > > //http://developer.android.com/reference/android/content/res/AssetFileD...
>
> > > > > protected void onActivityResult (int requestCode, int resultCode,
> > > > > Intent data){
>
> > > > > if (requestCode==4){ grab the result
> > > > > if (resultCode == RESULT_OK) {
> > > > > try {
> > > > > AssetFileDescriptor thePhoto =
> > > > > getContentResolver().openAssetFileDescriptor(data.getData(), "r");
> > > > > ...
>
> > > > > }
> > > > > }
> > > > > if (resultCode == RESULT_CANCELED) {
>
> > > > > }
> > > > > }
>
> > > > > On Tue, Dec 1, 2009 at 9:44 AM, Streets Of Boston
> > > > > <[email protected]>wrote:
>
> > > > > > Take a look the the Intent framework.
> > > > > > Start an activity given an intent (PICK_IMAGE) and this should start
> > > > > > any app that responds to it (Galleryor some other 3rd party
> > > > > > program).
>
> > > > > > For examples, just take a look at the Contacts application in
> > > > > > Android's framework's source-code.
>
> > > > > > On Dec 1, 4:28 am, Tom <[email protected]> wrote:
> > > > > > > Nobody?
>
> > > > > > > Tom
>
> > > > > > --
> > > > > > 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]<android-developers%2Bunsubs
> > > > > > [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