开发者

Accessing another third party app in android

How to access开发者_高级运维 another third party application from my application in android?


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

            }
        }

    }


You can visit this website for the available Third party intents supported by the Android: Website for Open Intents supported by Android

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜