0

我注意到,当我在Android设备上使用钛合金部署应用程序时,它的工作速度很慢,它看起来像Android应用程序需要时间触摸和click.Click后重定向到下一页到下一个页3或4秒内我点击任何UI元素(按钮,查看,标签,图像)如何使我的Android应用程序更快使用钛应用程序

在另一侧,其与IOS设备(iphone和ipad)

我不完全加工后吨知道什么应该完全是一个问题与Android.I也重置我的工厂数据在Android和测试应用程序再次,但仍然问题到达

是这个android touch/click问题?

请回复我的问题,并给我你的建议如何解决它。在此先感谢

+0

您能发布一个有此问题的控制器吗? – Giordano

回答

0

下面是一个页面我的控制器,查看文件中钛

---- index.js ---

function login(e) { 
    var uname = $.username.value.split(' ').join(''); 
    var pwd = $.password.value.split(' ').join(''); 

    if(uname == ""){ 
     alert("Enter username."); 
     return false; 
    } 
    if(pwd == ""){ 
     alert("Enter password."); 
     return false; 
    } 




    //if(results.length == 0){ 
    if (Titanium.Network.networkType === Titanium.Network.NETWORK_NONE) { 
      alert('There is no internet connection.'); 
      return false; 
     } 

     var loginReq = Titanium.Network.createHTTPClient(); 
     var params = { 
      func : "'"+Ti.Utils.base64encode('check_login')+"'", 
      username : uname, 
      password : pwd 
     }; 
     loginReq.onload = function() 
     { 
      var json = this.responseText; 
      var response = JSON.parse(json); 
      if(response == 'account_inactive'){ 
       alert('Your account has been inactive. Please contact to your company'); 
       //$.index.close(); 
       var index = Alloy.createController('index').getView(); 
       index.open(); 
       return false; 

      } 


      if(response == 'invalid'){ 
       alert('Invalid username or password'); 
       //$.index.close(); 
       var index = Alloy.createController('index').getView(); 
       index.open(); 
       return false;  
      } 

      else 
      { 
       results = { 
        iuser_id: response.iuser_id, 
        signup_ids: response.signup_ids, 
        staff_id : response.staff_id,   
        vusername: response.vusername, 
        vfirst_name: response.vfirst_name, 
        vlast_name: response.vlast_name, 
        vemail : response.vemail, 
        vpwd : response.vpwd 
        }; 
       Ti.App.Properties.setObject("user_session",results); 
       results = null; 
       var flag = ''; 

       if (!Ti.App.Properties.hasProperty('installed')) 
       { 
        Ti.App.Properties.setBool('app:isLoggedIn', true); 
        Ti.App.Properties.hasProperty('installed'); 
        Ti.App.Properties.setBool('installed', true); 
        var th_sign = Alloy.createController('login').getView(); 
        th_sign.open(); 
       } 
       else 
       { 

        var th_sign = Alloy.createController('account').getView(); 
        th_sign.open(); 
       } 
       }  

      json = null; 
      response = null; 
     }; 
     if(os_name == 'android'){ 
     loginReq.open("GET", WEB_ROOT+"get_init.php"); 
     } 
     else{ 
     loginReq.open("POST", WEB_ROOT+"get_init.php"); 
     } 
     loginReq.send(params); 

} 
$.index.open(); 

---- INDEX.XML --- ----

<Alloy> 
    <Window class="login_container" height="auto" horizontalWrap="true"> 
     <ScrollView id="scrollView_index" showVerticalScrollIndicator="true" height="100%" width="100%" scrollType="vertical"> 
      <View id="index_view"> 

       <ImageView class="logo" image="/images/login/logo.png" top='25' /> 

       <TextField id="username" class="usernameTxt" value="" border="0" top="230" /> 
       <TextField id="password" class="passwordTxt" value="" border="0" top="275" /> 
       <Button id="loginButton" class="login_bg" onClick="login">Login</Button> 


      </View>  

     </ScrollView>  
    </Window> 
</Alloy> 
1

您的问题不在于设备,而可能是您登录的API。我建议你插入一个指标来弥补这样的等待时间:

----index.xml---- 
<Alloy> 
    <Window class="login_container" height="auto" horizontalWrap="true"> 
    <ActivityIndicator id="activityIndicator" message="Wait please..."/> 

---- ---- index.js

function login(e) { 
var uname = $.username.value.split(' ').join(''); 
var pwd = $.password.value.split(' ').join(''); 

if(uname == ""){ 
    alert("Enter username."); 
    return false; 
} 
if(pwd == ""){ 
    alert("Enter password."); 
    return false; 
} 

$.activityIndicator.show(); 

而变化控制器前加

$.activityIndicator.hide(); 
0

我明白你说了什么,并通过使用活动指示器等待一段时间来解释但这只会解决登录活动的问题。但是,无论我在哪里使用UI实用程序,(Button Onclick,Label onclick,Image Onclick,View Onclick)至少需要4到5秒的时间才能重定向到下一页。我也在两页切换之间使用Loader但是仍然需要花费时间(4到5秒)来实现点击事件并重定向到下一页

+0

请不要添加答案,但注释;无论如何,你的智能手机有多少内存和哪个处理器?你可以尝试使用其他设备吗? – Giordano

相关问题