Quantcast
Channel: Appcelerator Developer Center Q&A Tag Feed (android)
Viewing all articles
Browse latest Browse all 7655

Merge label with image and upload the complete image

$
0
0

in my app user can click a image or select from photogallery enter his name and some details then upload it and also save it to his phone gallery.my problem is i am not able to merge label with image..i tried toimage() property but not getting the result.is there any other solution.thanks n advance.

var win         = Ti.UI.currentWindow;
 
var view=Ti.UI.createView({
    backgroundImage:'/flower.jpg',
    width:'200',
    height:'200',
    top:5
});
win.add(view);
var viewimage=view.toImage();
//alert(viewimage);
 
// Create an ImageView.
var anImageView = Ti.UI.createImageView({
    image : win.image,
    width : 'auto',
    height : 'auto',
    top : 5,
 
});
// the parent view.
view.add(anImageView);
 
//-- Are formatted text field
var name = Ti.UI.createLabel({
    text:win.name,
    font:{
        fontFamily:'Verdana',
        fontSize:17
    },
    color:'red',
    textAlign:'left',
    width:160,
    height:160,
    //left:10
});
//view.add(name);
view.add(name);
//-- Order Button
var send = Ti.UI.createButton({
    width:137,
    height:55,
    title:'send',
    bottom:5,
    left:165,
});
 
//-- Cancel Button
var cancel = Ti.UI.createButton({
    width:137,
    height:55,
    title:'cancel',
    bottom:5,
    left:10,
});
 
win.add(send);
win.add(cancel);
 
//-- Cancel button event. Goes back to the toppings window and remembers the users selections
cancel.addEventListener('click',function(){
    Ti.App.fireEvent('resetApp');
});
 
//-- Submit send. Check if the text fields are blank
send.addEventListener('click',function(e){
 
     var xhr = Titanium.Network.createHTTPClient();
 
    xhr.onerror = function(e)
    {
        Ti.API.info('IN ERROR ' + e.error);
    };
    xhr.onload = function()
    {
        Ti.API.info('IN ONLOAD ' + this.status + ' readyState ' + this.readyState);
    };
    xhr.onsendstream = function(e)
    {
        ind.value = e.progress ;
        Ti.API.info('ONSENDSTREAM - PROGRESS: ' + e.progress+' '+this.status+' '+this.readyState);
    };
    // open the client
    xhr.open('POST','');
    xhr.setRequestHeader("Connection", "close");
    // send the data
    xhr.send({media:view});
});

Viewing all articles
Browse latest Browse all 7655

Trending Articles