Languages

Menu
Sites
Language
reply.length is always 1 no matter how many images are chosen (selection_mode , multiple , images, ApplicationControl)
I'm struggling to get choosen image url paths, but reply.length is always 1 no matter how many images are chosen.
How to solve the issue?
 
var array = [];
 
try {
    var appControl = new tizen.ApplicationControl(
        "http://tizen.org/appcontrol/operation/pick",
        null,
        "image/*",
        null, [new tizen.ApplicationControlData("http://tizen.org/appcontrol/data/selection_mode", ["multiple"])]);
 
    var appControlReplyCallback = {
        onsuccess: function(reply) {
            for (var i = 0; i < reply.length; i++) {
              if (reply[i].key === "http://tizen.org/appcontrol/data/selected") {
                   array.push(reply[i].value[0]);
               }
            }
        },
        onfailure: function() {
            console.log("The launch application control failed");
        }
    };
    tizen.application.launchAppControl(
        appControl,
        null,
        function() {
            console.log("launch application control succeed");
        },
        function(e) {
            console.log("launch application control failed. reason: " + e.message);
        },
        appControlReplyCallback
    );
} catch (e) {
    alert("Error " + e.name + " : " + e.message);
}
Edited by: Anonymous on 03 May, 2019
View Selected Answer

Responses

1 Replies
Mark as answer

I found out the solution by myself :D

I thought that the list of chosen images was in reply array but it turned out reply array contained another array of chosen images reply[i].value[i] :D

So reply[i].value[0] is the first image, reply[i].value[1] is the second one and so on!

reply[i].value.length returns the number of chosen images!