tags:

views:

67

answers:

1

How to access another third party application from my application in android?

+2  A: 

You must start by creating an intent. If the activity launched has to return a result, you start your activity by calling the method startActivityForResult, and you will receive the result in the method onActivityResult. If you aren't waiting result from this activity, just call startActivity.

In those method calls, you 'll have to pass your intent in the parameters.

In this example, i call the android gallery to allow the user to choose an image.

protected void chooseImage()
        {
            Intent intent = new Intent();
            intent.setType("image/*");
            intent.setAction(Intent.ACTION_GET_CONTENT);
            startActivityForResult(Intent.createChooser(intent,
                    "Select Picture"), ACTIVITY_CHOOSE_IMAGE);
        }

Then, i receive the image choosen by the user, resulting of the previous activity:

@Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {

        if (resultCode == RESULT_OK) {
            if (requestCode == ACTIVITY_CHOOSE_IMAGE) {
                //Traitement sur l'image

            }
        }

    }
Clem
can you post some code snippets plz?
Praveen Chandrasekaran
Is it clear? or do you want more informations?
Clem
i am not asking about built in apps. i mean some youtube or third party apps dude.
Praveen Chandrasekaran
okay...so sorry i can't help. I think it works the same, by creating an intent. But never tried...i'm still an android learner
Clem
3rd party apps should work the same way...the 3rd party app needs to listen for a particular intent type in order for you to interact with it. The documentation for a particular app should tell you what services it provides.
Mayra