session management in android

Put problems with the Android NDK in this forum.

session management in android

Postby krishnaveni » Tue Jul 24, 2012 8:43 am

Hi i successfully developed one login form.here if i fill in the correct information means it is redirect to next activity.the next activity have to displayed parse the username successfully.now i wish to click logout button means it is go to login activity.its fine.now i ll go back on my emulator means it is does not stay on login page.it is move to displayed username activity.so how is handling session here.please guide me.

my code is:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. package com.androidlogin.ws;
  2.  
  3. import org.ksoap2.SoapEnvelope;
  4. import org.ksoap2.serialization.PropertyInfo;
  5. import org.ksoap2.serialization.SoapObject;
  6. import org.ksoap2.serialization.SoapPrimitive;
  7. import org.ksoap2.serialization.SoapSerializationEnvelope;
  8. import org.ksoap2.transport.HttpTransportSE;
  9. import android.app.Activity;
  10. import android.os.Bundle;
  11. import android.view.View;
  12. import android.widget.Button;
  13. import android.widget.EditText;
  14. import android.widget.TextView;
  15.  
  16. public class AndroidLoginExampleActivity extends Activity {
  17.  private final String NAMESPACE = "http://ws.userlogin.com";
  18.     private final String URL = "http://111.223.128.10:8085/AndroidLogin/services/Login?wsdl";
  19.     private final String SOAP_ACTION = "http://ws.userlogin.com/authentication";
  20.     private final String METHOD_NAME = "authentication";
  21.     /** Called when the activity is first created. */
  22.     @Override
  23.     public void onCreate(Bundle savedInstanceState) {
  24.         super.onCreate(savedInstanceState);
  25.         setContentView(R.layout.main);
  26.         Button login = (Button) findViewById(R.id.btn_login);
  27.         login.setOnClickListener(new View.OnClickListener() {
  28.    
  29.    public void onClick(View arg0) {
  30.     loginAction();
  31.      
  32.    }
  33.   });
  34.     }
  35.      
  36.     private void loginAction(){
  37.      SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
  38.      
  39.         EditText userName = (EditText) findViewById(R.id.tf_userName);
  40.         String user_Name = userName.getText().toString();
  41.         EditText userPassword = (EditText) findViewById(R.id.tf_password);
  42.         String user_Password = userPassword.getText().toString();
  43.          
  44.       //Pass value for userName variable of the web service
  45.         PropertyInfo unameProp =new PropertyInfo();
  46.         unameProp.setName("userName");//Define the variable name in the web service method
  47.         unameProp.setValue(user_Name);//set value for userName variable
  48.         unameProp.setType(String.class);//Define the type of the variable
  49.         request.addProperty(unameProp);//Pass properties to the variable
  50.        
  51.       //Pass value for Password variable of the web service
  52.         PropertyInfo passwordProp =new PropertyInfo();
  53.         passwordProp.setName("password");
  54.         passwordProp.setValue(user_Password);
  55.         passwordProp.setType(String.class);
  56.         request.addProperty(passwordProp);
  57.            
  58.         SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
  59.         envelope.setOutputSoapObject(request);
  60.         HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
  61.          
  62.         try{
  63.             androidHttpTransport.call(SOAP_ACTION, envelope);
  64.                SoapPrimitive response = (SoapPrimitive)envelope.getResponse();
  65.                  
  66.                TextView result = (TextView) findViewById(R.id.tv_status);
  67.                result.setText(response.toString());
  68.            
  69.         }
  70.         catch(Exception e){
  71.            
  72.         }
  73.        }
  74.      
  75. }
Parsed in 0.042 seconds, using GeSHi 1.0.8.4
[/syntax]


Please guide me.how is to do.
krishnaveni
Junior Developer
Junior Developer
 
Posts: 10
Joined: Wed Dec 21, 2011 6:23 am

Top

Return to NDK Problems

Who is online

Users browsing this forum: Google Feedfetcher and 3 guests