Code example for ResultReceiver

Methods: send

	protected void onHandleIntent(Intent intent) {
		Log.d(TAG, "onHandleIntent(intent=" + intent.toString() + ")");
		final ResultReceiver receiver = intent.getParcelableExtra(EXTRA_STATUS_RECEIVER);
		if (receiver != null)
			receiver.send(STATUS_RUNNING, Bundle.EMPTY);
		try { 
			final long startRemote = System.currentTimeMillis();
			mRemoteExecutor.executeGet(URL, new TwunchesHandler());
			Log.d(TAG, "Remote sync took " + (System.currentTimeMillis() - startRemote) + "ms");
		} catch (Exception e) {
			Log.e(TAG, "Problem while syncing", e);
			if (receiver != null) {
				// Pass back error to surface listener 
				final Bundle bundle = new Bundle();
				bundle.putString(Intent.EXTRA_TEXT, e.toString());
				receiver.send(STATUS_ERROR, bundle);
		// Announce success to any surface listener 
		Log.d(TAG, "sync finished");
		if (receiver != null)
			receiver.send(STATUS_FINISHED, Bundle.EMPTY);
	 * Generate and return a {@link HttpClient} configured for general use, 
	 * including setting an application-specific user-agent string. 
Stop searching for code, let great code find you!  Add Codota to your java IDE