Android Question Need Help For Login With WebService

Discussion in 'Android Questions' started by hendrayulianto, Jun 14, 2015.

  1. hendrayulianto

    hendrayulianto Member Licensed User

    Helo,
    I need help, i have develop for "login menu" using web service asp.net, can anyone give simple example for this.
    just type username and password call web service http://www.traveloista.com/traveloista.asmx?LoginUser
    and if true redirect to another page.

    Thanks i really need your help ...
     
  2. Ohanian

    Ohanian Active Member Licensed User

    Hi,

    here's a simple sample :

    Code:
    Sub Globals
        
    'These global variables will be redeclared each time the activity is created.
        'These variables can only be accessed from this module.

        
    Dim edtUserName, edtPassword As EditText
        
    Dim btnLogin As Button
       
        
    Dim MyJob As HttpJob
       
    End Sub

    Sub Activity_Create(FirstTime As Boolean)
        
    'Do not forget to load the layout file created with the visual designer. For example:
        'Activity.LoadLayout("Layout1")

        edtUserName.Initialize(
    "")
        edtPassword.Initialize(
    "")
        edtPassword.PasswordMode = 
    True
       
        btnLogin.Initialize(
    "Login")
        btnLogin.Text = 
    "Login"
       
        
    Activity.AddView(edtUserName, 00100%x40dip)
        
    Activity.AddView(edtPassword, 0, edtUserName.Top + edtUserName.Height, 100%x40dip)
        
    Activity.AddView(btnLogin, 0, edtPassword.Top + edtPassword.Height, 100%x40dip)

    End Sub

    Sub Activity_Resume

    End Sub

    Sub Activity_Pause (UserClosed As Boolean)

    End Sub

    Sub Login_Click
        
    ProgressDialogShow2("Please Wait..."False)
        MyJob.Initialize(
    "Login", Me)
        MyJob.PostString(
    "http://www.traveloista.com/traveloista.asmx/LoginUser""UserName=" & edtUserName.Text & "&Password=" & edtPassword.Text)   
    End Sub

    Sub JobDone (Job As HttpJob)
        
    ProgressDialogHide
        
    Select Case Job.JobName
            
    Case "Login"
                
    If Job.Success Then               
                    
    Log(Job.GetString)
                   
                    
    If Job.GetString.Contains(">true<"Then
                        
    Log("Login > OK")
                    
    Else
                        
    Log("Login > Failed")
                    
    End If               
                
    Else
                    
    'an error occurred
                End If
        
    End Select   
        Job.Release
    End Sub
     
  3. nadhiras

    nadhiras Member Licensed User

  4. hendrayulianto

    hendrayulianto Member Licensed User

    Thank you very much this really works and helpfull
     
Loading...