Best code examples for Android ResultReceiver class (android.os.ResultReceiver)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android ResultReceiver class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Android ResultReceiver examples from Open Source projects
This code example shows how to use the following methods: send
	protected void onHandleIntent(Intent intent) {
		final ResultReceiver receiver = intent.getParcelableExtra("receiver");
		String command = intent.getStringExtra("command");
		Bundle bundle = new Bundle();
		if (command.equals("query")) {
			receiver.send(STATUS_RUNNING, Bundle.EMPTY);
			DataSource dataSource = new DataSource(getApplicationContext());
			try { 
				final ISipgateAPI sipgate = new SipgateXmlRpcImpl();
				dataSource.open(false);
 
				queryAccount(sipgate, dataSource);
				receiver.send(STATUS_UPDATED_ACCOUNT, bundle);
 
				queryCalls(sipgate, dataSource);
				receiver.send(STATUS_UPDATED_CALLS, bundle);
			} catch (Exception e) {
				Log.e("QueryService", "Error when updating", e);
 
				if (e instanceof AuthenticationException) {

6
CodeRank
This code example shows how to use the following methods: send
            // TODO Auto-generated catch block 
            e.printStackTrace();
        } 
		 
		final ResultReceiver receiver = intent.getParcelableExtra(EXTRA_STATUS_RECEIVER);
        if (receiver != null) receiver.send(STATUS_RUNNING, Bundle.EMPTY);
         
        params = null; // disable till ...
        String jsonText = new RemoteExecutor().executeCommand(command, params);
        if (jsonText == null || jsonText.equals(""))
        { 
                final Bundle bundle = new Bundle();
            bundle.putString(Intent.EXTRA_TEXT, "No Connection");
            receiver.send(STATUS_ERROR, bundle);
        } 
        else 
        { 
                 Log.d(TAG, "sync finished");
                 final Bundle bundle = new Bundle();
                  

6
CodeRank
This code example shows how to use the following methods: send
5
CodeRank
This code example shows how to use the following methods: send
		resultReceiver = (ResultReceiver) intent.getParcelableExtra("com.merybere.app.EXTRA_MYRESULTRECEIVER");
		 
		// Comprobar que nos han pasado el resultReceiver, para evitar null pointer exception 
		if(resultReceiver != null) {
			// Al arrancar, mandar un result code 1 
			resultReceiver.send(1, null);
		} 
		 
		Dummy heavyTask = new Dummy();
		heavyTask.hardWork();
 
		if(resultReceiver != null) {
			resultReceiver.send(0, null);
		} 
	} 
 
	@Override 
	public void onCreate() { 
		Log.d(TAG, "onCreate");
		super.onCreate(); 
Full Snippet Info
5
CodeRank
This code example shows how to use the following methods: send
				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());

5
CodeRank
Related Android ResultReceiver Questions & Answers:
See Code Examples for Android ResultReceiver Methods: