언어 설정

Menu
Sites
Language
On a button click camera is open and photo clicked.I want photo should aapper in my application canvas background not in gallery

Hi,

I have created a button when i click on button camera has opend and image has saved in mobile gallery.I want this camera pic should be appear in my application canvas background.How can i do this please help me.My code link is

 

 

https://github.com/mohittripathi/LocketPhoto

 

 

thanks and regards

Mohit Kumar

 

Responses

6 댓글
Marco Buettner
if (data.key === "http://tizen.org/appcontrol/data/selected") {
    picLink = data.value[0];
    console.log("selected image := " + picLink);
}

Store the URL of the image did you "create" via camera...

Use the URI and draw it on your canvas ;)

mohit kumar

Hi,

The statement inside

if (data.key === "http://tizen.org/appcontrol/data/selected") is not executed because condition may be false.Could you explain more please.Here i cnage the path using session.

$("#camera").click(function() {
        var appId = null,
            appControlReplyCallback = null,
            appControl = null;
        appId = 'tizen.camera';
        appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/create_content", null, "image/jpeg", null);
        appControlReplyCallback = {
            onsuccess: function(data) {
                
                var picLink = "";
                if ($.mobile.popup.active) {
                   $.mobile.popup.active.close();
                    
                }
                if (data.key === "http://tizen.org/appcontrol/data/selected") {
                    picLink = data.value[0];
                    console.log("selected image := " + picLink);                   
                    sessionStorage.setItem("mohit", picLink);
                }
                
            },
            onfailure: function() {
                //console.log('The launch application control failed');
            }
        };
        function onSuccess() {
            //console.log("launch application control succeed");
        }
        function onError(err) {
            alert(err.message);
        }
        tizen.application.launchAppControl(appControl, appId, onSuccess, onError, appControlReplyCallback);
    });

 

Thanks and regards

Mohit Kumar

Marco Buettner
for(var i=0;i<data.length;i++) {
    if(data[i].key === "http://tizen.org/appcontrol/data/selected") {
        picLink = data[i].value[0];
        console.log("selected image := " + picLink);                   
        sessionStorage.setItem("mohit", picLink);
    }
}

I forget that the argument of onsuccess is an array.

Use that method above or you can use directly data[0].key and data[0].value[0]

mohit kumar

Hi,

As per you told me please check.Whether i am right or not.My code is again not working.When i change the parameter of onsuccess function as data[0].value[0] it display red line,please help me.

$("#camera").click(function() {
        var appId = null,
            appControlReplyCallback = null,
            appControl = null;
        appId = 'tizen.camera';
        appControl = new tizen.ApplicationControl("http://tizen.org/appcontrol/operation/create_content", null, "image/jpeg", null);
        appControlReplyCallback = {
            onsuccess: function(data) {
                
                var picLink = "";
                
                
                for(var i=0;i<data.length;i++) {
                    if(data[i].key === "http://tizen.org/appcontrol/data/selected") {
                        picLink = data[i].value[0];
                      //  console.log("selected image := " + picLink);                   
                        sessionStorage.setItem("mohit", picLink);
                    }
                }
                
                if ($.mobile.popup.active) {
                   $.mobile.popup.active.close();
                    
                }
                if (data.key === "http://tizen.org/appcontrol/data/selected") {
                    picLink = data[0].value[0];
                    console.log("selected image := " + picLink);
                    alert(picLink);
                    //sessionStorage.setItem("mohit", picLink);
                     
                }
                
            },
            onfailure: function() {
                //console.log('The launch application control failed');
            }
        };
        function onSuccess() {
            //console.log("launch application control succeed");
        }
        function onError(err) {
            alert(err.message);
        }
        tizen.application.launchAppControl(appControl, appId, onSuccess, onError, appControlReplyCallback);
    });

Marco Buettner

told me what error you get... <.<

mohit kumar

Hi,

Sorry it is working fine.

 

 

 

Thanks and regards

Mohit Kumar