Get a session token after logging with json
I'm developing a native android client app that is connected with a server,

To login into this server I must send a json in this form 
                    
    {"email": "test@test.com", "password": "1234", "stayLogged": "1"}

to a webservice method named *startSession* 

if the login is successful the method returns in response a json in this form

    {"token": "1234", "idClient": "1234"}

I don't know how I can get the token value.

   The code to send the login data that I have wrote is the follow(I'm not sure that this code is correct, if there is something wrong, notify me) :

                    String email="test@test";
	    			String password="1234";
	    			String stayLogged="1";
	    			String idClient="ANDROID";
	    			try { 	    				
	    			    json.put("email", email); 
	    			    json.put("password", password);
	    			    json.put("stayLogged", stayLogged);
	    			    json.put("idClient", idClient);
	    			    JSONArray postjson=new JSONArray(); 
	    			    postjson.put(json); 
	    			    httppost.setHeader("json",json.toString());
	    			    httppost.getParams().setParameter("jsonpost",postjson); 
	    			    System.out.print(json); 
	    			    HttpResponse response = mClient.execute(httppost); 

	    			    if(response != null){
	    			    	InputStream is = response.getEntity().getContent();

	    			    	BufferedReader reader = new BufferedReader(new InputStreamReader(is));
	    			    	StringBuilder sb = new StringBuilder();

	    			    	String line = null;
	    			    	loggato=true;
	    			    try {
	    			    		while ((line = reader.readLine()) != null) {
	    			            sb.append(line + "\n");
	    			    		}
	    			    		
	    			        } catch (IOException e) {
	    			        	e.printStackTrace();
	    			        } finally {
	    			        	try {
	    			        		is.close();
	    			        	} catch (IOException e) {
	    			        		e.printStackTrace();
	    			        	}
	    			        }
	    			   // text = sb.toString();
	    			    }
	    			   // tv.setText(text);

	    			}catch (ClientProtocolException e) {
	    			    // TODO Auto-generated catch block
	    			} catch (IOException e) {
	    			    // TODO Auto-generated catch block
	    			}
	    			
	    			if(loggato=true){
	    				Intent welcome = new Intent(MainView.this, Benvenuto.class);
	    	    		startActivity(welcome);  
	    			}



Get a session token after logging with json
===

I'm developing a native android client app that is connected with a server,

To login into this server I must send a json in this form 
                    
    {"email": "test@test.com", "password": "1234", "stayLogged": "1"}

to a webservice method named *startSession* 

if the login is successful the method returns in response a json in this form

    {"token": "1234", "idClient": "1234"}

I don't know how I can get the token value.

   The code to send the login data that I have wrote is the follow(I'm not sure that this code is correct, if there is something wrong, notify me) :

                    String email="test@test";
	    			String password="1234";
	    			String stayLogged="1";
	    			String idClient="ANDROID";
	    			try { 	    				
	    			    json.put("email", email); 
	    			    json.put("password", password);
	    			    json.put("stayLogged", stayLogged);
	    			    json.put("idClient", idClient);
	    			    JSONArray postjson=new JSONArray(); 
	    			    postjson.put(json); 
	    			    httppost.setHeader("json",json.toString());
	    			    httppost.getParams().setParameter("jsonpost",postjson); 
	    			    System.out.print(json); 
	    			    HttpResponse response = mClient.execute(httppost); 

	    			    if(response != null){
	    			    	InputStream is = response.getEntity().getContent();

	    			    	BufferedReader reader = new BufferedReader(new InputStreamReader(is));
	    			    	StringBuilder sb = new StringBuilder();

	    			    	String line = null;
	    			    	loggato=true;
	    			    try {
	    			    		while ((line = reader.readLine()) != null) {
	    			            sb.append(line + "\n");
	    			    		}
	    			    		
	    			        } catch (IOException e) {
	    			        	e.printStackTrace();
	    			        } finally {
	    			        	try {
	    			        		is.close();
	    			        	} catch (IOException e) {
	    			        		e.printStackTrace();
	    			        	}
	    			        }
	    			   // text = sb.toString();
	    			    }
	    			   // tv.setText(text);

	    			}catch (ClientProtocolException e) {
	    			    // TODO Auto-generated catch block
	    			} catch (IOException e) {
	    			    // TODO Auto-generated catch block
	    			}
	    			
	    			if(loggato=true){
	    				Intent welcome = new Intent(MainView.this, Benvenuto.class);
	    	    		startActivity(welcome);  
	    			}


