Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

App with Login and tabbed window on click

$
0
0

The info for my app:

  • Application type: mobile
  • Titanium SDK: Titanium SDK version 3.2.0.GA
  • Platform & version: Android 4.4.2
  • Device: Android emulator with android 2.3.3 (API level 10)
  • Host Operating System: Windows 7
  • Titanium Studio: Titanium Studio, build: 3.2.0.201312191547

Hi I need to create an application that uses Android system and then login as you have the correct credentials to go to a window with tabs.

I have this code for authentication in app.js, it works fine for now but I have not managed to create the structure of tabs, If you have some time for support me, appreciate any information to drive in that:

var win = Ti.UI.createWindow({
    backgroundColor: '#096594', 
    title: 'ACCESS CONFIG', 
    layout:'vertical',
    navBarHidden:true,
    fullscreen:false, 
     exitOnClose:true
});
 
var my_navbar = Ti.UI.createLabel({
    height:20,
    backgroundColor:'#989898',
    color:'#fff',
    text:'  ACCESS CONFIG',
    top:0,
    width:'100%',
    font:{fontSize:11,fontWeight:'normal'},
    marginleft:10
});
win.add(my_navbar);
 
win.add(Ti.UI.createLabel({
    top:10, 
    height:15, 
    left:10, 
    right:5,
    color:'#fff',
    textAlign:'left',
    text:'Usuario: [Userid]', 
    font:{fontSize:12},
    bottom:5
}));
 
var txtUserid = Ti.UI.createTextField({
    value:'1',
    hintText:'user ID',
    height:35, 
    left:5, 
    right:5,
    font:{fontSize:12},
    color:'#a2a2a2',
    borderStyle:Ti.UI.INPUT_BORDERSTYLE_ROUNDED 
}); 
win.add(txtUserid);
 
win.add(Ti.UI.createLabel({
    top:2, 
    height:17, 
    left:10, 
    right:5,
    color:'#fff',
    textAlign:'left',
    text:'Name: [Login]', 
    font:{fontSize:12},
    bottom:5
}));
 
var txtLogin = Ti.UI.createTextField({
    value:'M',
    hintText:'Username',
    height:35, 
    left:5, 
    right:5,
    font:{fontSize:12},
    color:'#a2a2a2',
    borderStyle:Ti.UI.INPUT_BORDERSTYLE_ROUNDED 
}); 
win.add(txtLogin);  
 
win.add(Ti.UI.createLabel({
    top:2, 
    height:17, 
    left:10, 
    right:5,
    color:'#fff',
    textAlign:'left',
    text:'Password: [Password]', 
    font:{fontSize:12},
    bottom:5
}));
 
var txtPassword = Ti.UI.createTextField({
    value:'111',
    hintText:'Contraseña',
    passwordMask:true,
    height:35, 
    left:5, 
    right:5,
    font:{fontSize:12},
    color:'#a2a2a2',
    borderStyle:Ti.UI.INPUT_BORDERSTYLE_ROUNDED 
}); 
win.add(txtPassword);
 
win.add(Ti.UI.createLabel({
    top:10,
    height:0, 
    left:5, 
    right:5,
    color:'#000',
    textAlign:'left',
    text:'Authentication Url:', 
    font:{fontSize:18}
    }));
 
var txtUrl = Ti.UI.createTextField({
    value:'http://',
    hintText:'Url to connect with data',
    height:0, left:5, right:5,
    borderStyle:Ti.UI.INPUT_BORDERSTYLE_ROUNDED 
}); 
win.add(txtUrl);
 
 
var yesButton = Ti.UI.createButton({
    title:'Connect with DATA', 
    top:5, 
    height:37, 
    left:85, 
    right:85,
    color:'#fff',
    backgroundColor:'#406a83',
    borderColor:'#688a9d',
    borderWidth:1,
    borderRadius:5,
    borderStyle:Ti.UI.INPUT_BORDERSTYLE_BEZEL   
});
win.add(yesButton);
 
 
yesButton.addEventListener('click', clickYesButton);
 
function clickYesButton(e) {
    var button = e.source;
    var xhr=Titanium.Network.createHTTPClient();   
    xhr.onerror = function(e){alert('Error: '+e.error);};
    xhr.onload = function() {alert(this.responseText);};
    xhr.open("POST",txtUrl.value);//ADD your URL
    var param={"userid":txtUserid.value,"login":txtLogin.value,"password":txtPassword.value};
    Ti.API.info('Params'+JSON.stringify(param));
    xhr.send(param);
}
 
win.open();
Regards,

Jotace


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>