Code example for Handler

Methods: post

0
    protected void onCreateCommon(final Runnable postDrawCallback) {
        mDrawCallback = new Runnable() {
            @Override 
            public void run() { 
                mRedrewFlag = true;
                mHandler.post(postDrawCallback);
            }; 
        }; 
        getWindow().setBackgroundDrawable(new ColorDrawable(0xffefefef));
        ResourceModifiers.init(getResources());
 
        mHardwareView = (MainView) findViewById(R.id.hardware_view);
        mHardwareView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
        mHardwareView.setBackgroundColor(Color.WHITE);
        mHardwareView.addDrawCallback(mDrawCallback);
 
        int width = getResources().getDimensionPixelSize(R.dimen.layer_width);
        int height = getResources().getDimensionPixelSize(R.dimen.layer_height);
        mSoftwareBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
        mHardwareBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);