Handler post - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Handler post method.

This code example shows how to use the following methods: post
    final Handler handler = new Handler();
    Timer t = new Timer();
    t.schedule(new TimerTask() {
      @Override 
      public void run() { 
        handler.post(new Runnable() {
          public void run() { 
            // This will kill the parent, a bad idea. 
//            parent.finish(); 
            // This will start the browser, a better idea 
            launchIntent(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com/")));
          } 
        }); 
      } 
    }, DELAY_MS);
  } 
} 
Full Snippet Info
9
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: post
        if (DEBUG) Slog.d(TAG, String.format( "Startup with UMS connection %s (media state %s)",
                mUmsAvailable, Environment.getExternalStorageState()));
         
        HandlerThread thr = new HandlerThread("SystemUI StorageNotification");
        thr.start();
        mAsyncEventHandler = new Handler(thr.getLooper());
 
        onUsbMassStorageConnectionChanged(connected);
    } 
 
    /* 
     * @override com.android.os.storage.StorageEventListener 
     */ 
    @Override 
    public void onUsbMassStorageConnectionChanged(final boolean connected) {
        mAsyncEventHandler.post(new Runnable() {
            @Override 
            public void run() { 
                onUsbMassStorageConnectionChangedAsync(connected);
            } 
        }); 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: post
     * @param itemId a string identifying the item 
     * @param quantity the quantity of items in this purchase 
     */ 
    void postPurchaseStateChange(final PurchaseState purchaseState, final String itemId,
            final int quantity, final long purchaseTime, final String developerPayload) {
        mHandler.post(new Runnable() {
            @Override 
            public void run() { 
                onPurchaseStateChange( 
                        purchaseState, itemId, quantity, purchaseTime, developerPayload);
            } 
        }); 
    } 
} 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: post, get
	 
	public static <T> T callInMainThread(Callable<T> call) throws Exception {
		if (isMainThread()) 
			return call.call();
		else { 
			FutureTask<T> task = new FutureTask<T>(call);
			getHandler().post(task);
			return task.get();
		} 
	} 
} 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: post
    } 
 
    public PicasaService() { 
        super(); 
        mSyncThread.start();
        mSyncHandler = new Handler(mSyncThread.getLooper());
        mSyncHandler.post(new Runnable() {
            public void run() { 
                Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
            } 
        }); 
    } 
 
    private static PicasaContentProvider getContentProvider(Context context) {
        ContentResolver cr = context.getContentResolver();
        ContentProviderClient client = cr.acquireContentProviderClient(PicasaContentProvider.AUTHORITY);
        return (PicasaContentProvider) client.getLocalContentProvider();
    } 
 
    @Override 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Handler post Questions & Answers:

post Method Overview
Causes the Runnable r to be added to the message queue.
See Code Examples for other Android Handler Methods: