언어 설정

Menu
Sites
Language
How to open a gallery.

I want to open a gallery in tizen app.How to do that.

Responses

4 댓글
rohit sijwali

Ok i got it. But how i get the file path in callback

 

 

#define SELECT_FILE_APP_ID "tizen.filemanager"

#define SELECT_FILE_OPERATION_ID "http://tizen.org/appcontrol/operation/pick"

#define SELECT_FILE_MIME_TYPE "IMAGE"

 

#define SELECT_FILE_ERROR -1

#define SELECT_FILE_SUCCESS    0

 

static void _get_select_cb(app_control_h request, app_control_h reply, app_control_result_e result, void *user_data)

{

dlog_print(DLOG_ERROR, LOG_TAG, "Select Callback Called");

}

 

int openGallery()

{

    app_control_h app_control;

    int ret = app_control_create(&app_control);

    int retStatus=SELECT_FILE_ERROR;

if (ret == APP_CONTROL_ERROR_NONE)

    {

            app_control_set_app_id(app_control, SELECT_FILE_APP_ID);

            app_control_set_operation(app_control, SELECT_FILE_OPERATION_ID);

            app_control_set_mime(app_control,SELECT_FILE_MIME_TYPE);

 

 

 

            ret = app_control_send_launch_request(app_control, _get_select_cb, NULL);

 

            if (ret == APP_CONTROL_ERROR_NONE )

            {

                dlog_print(DLOG_ERROR, LOG_TAG, "Open Gallery Sucessfull!");

                retStatus=SELECT_FILE_SUCCESS;

 

 

            }

            else

            {

                switch(ret)

                {

                case APP_CONTROL_ERROR_INVALID_PARAMETER:

                    dlog_print(DLOG_ERROR, LOG_TAG, "APP_CONTROL_ERROR_INVALID_PARAMETER");

                    break;

                case APP_CONTROL_ERROR_OUT_OF_MEMORY:

                    dlog_print(DLOG_ERROR, LOG_TAG, "APP_CONTROL_ERROR_OUT_OF_MEMORY");

                    break;

                case APP_CONTROL_ERROR_APP_NOT_FOUND:

                    dlog_print(DLOG_ERROR, LOG_TAG, "APP_CONTROL_ERROR_APP_NOT_FOUND");

                    break;

                case APP_CONTROL_ERROR_KEY_NOT_FOUND:

                    dlog_print(DLOG_ERROR, LOG_TAG, "APP_CONTROL_ERROR_KEY_NOT_FOUND");

                    break;

                case APP_CONTROL_ERROR_KEY_REJECTED:

                    dlog_print(DLOG_ERROR, LOG_TAG, "APP_CONTROL_ERROR_KEY_REJECTED");

                    break;

                case APP_CONTROL_ERROR_INVALID_DATA_TYPE:

                    dlog_print(DLOG_ERROR, LOG_TAG, "APP_CONTROL_ERROR_INVALID_DATA_TYPE");

                    break;

                case APP_CONTROL_ERROR_LAUNCH_REJECTED:

                    dlog_print(DLOG_ERROR, LOG_TAG, "APP_CONTROL_ERROR_LAUNCH_REJECTED");

                    break;

                case APP_CONTROL_ERROR_PERMISSION_DENIED:

                    dlog_print(DLOG_ERROR, LOG_TAG, "APP_CONTROL_ERROR_PERMISSION_DENIED");

                    break;

                case APP_CONTROL_ERROR_LAUNCH_FAILED:

                    dlog_print(DLOG_ERROR, LOG_TAG, "APP_CONTROL_ERROR_LAUNCH_FAILED");

                    break;

                case APP_CONTROL_ERROR_TIMED_OUT:

                    dlog_print(DLOG_ERROR, LOG_TAG, "APP_CONTROL_ERROR_TIMED_OUT");

                    break;

                }

            }

 

        }

      else

      {

          retStatus=SELECT_FILE_ERROR;

        }

 

    if (app_control != NULL){

        app_control_destroy(app_control);

    }

    return retStatus;

}

 

daniel kim

Hi,

I would suggest you to refer to below code snippet as well. it looks lik that you can get path of selected data from gallery in your application in this code.

  https://developer.tizen.org/community/code-snippet/web-code-snippet/gallery-application-control

Regards

rohit sijwali

Actually i m able to select the file.

But what is the key to get the path in

app_control_get_extra_data

 

function

i m using 

http://tizen.org/appcontrol/data/selected

 

But getting error -126 which means

APP_CONTROL_ERROR_KEY_NOT_FOUND

Alex Dem

Hi,
For operation pick try to use approach described here :
https://developer.tizen.org/forums/native-application-development/getting-result-filemanager
try to use "path" key to extract path to selected file .
Alexey.