Code example for ResultReceiver

Methods: send

0
				Log.d(TAG, "LOGOUT_CMD");
				logout(receiver, b);
			} 
		} catch (SocketTimeoutException e) {
			Log.e(TAG, e.getMessage());
			receiver.send(STATUS_CONNECTION_ERROR, b);
		} catch (JSONException e) {
			Log.e(TAG, e.getMessage());
			receiver.send(STATUS_ERROR, b);
		} catch (ClientProtocolException e) {
			Log.e(TAG, e.getMessage());
			receiver.send(STATUS_ERROR, b);
		} catch (IllegalArgumentException e) {
			Log.e(TAG, e.getMessage());
			receiver.send(STATUS_ILLEGAL_ARGUMENT, b);
		} catch (IOException e) {
			Log.e(TAG, e.getMessage());
			receiver.send(STATUS_ERROR, b);
		} catch (Exception e) {
			Log.e(TAG, e.getMessage());
		} 
 
		this.stopSelf();
	} 
 
	private void logout(ResultReceiver receiver, Bundle b) {
		SharedPreferences settings = getSharedPreferences("LOGIN", 0);
		Map<String, ?> map = settings.getAll();
		String username = (String) map.get("user");
		String token = (String) map.get("token");
		Editor edit = settings.edit();
		edit.remove("LOGIN");
		edit.commit();
		// final DefaultHttpClient client = new DefaultHttpClient(); 
		// final HttpResponse response; 
		// response = client.execute(new HttpGet(APIurl + 
		// "Security.groovy?method=SingOut&username"+username+"&token="+token)); 
		// final String xmlToParse = EntityUtils.toString(response.getEntity()); 
		// Log.d(TAG, xmlToParse.toString()); 
		String response;
		// response = fromXMLtoResponce(xmlToParse, catId); 
		response = "OK";
 
		b.putSerializable("return", (Serializable) response);
		receiver.send(STATUS_OK, b);
 
	} 
 
	@SuppressWarnings("unused") 
	private void validate(ResultReceiver receiver, Bundle b)