Example usage for android.widget FrameLayout forceLayout

List of usage examples for android.widget FrameLayout forceLayout

Introduction

In this page you can find the example usage for android.widget FrameLayout forceLayout.

Prototype

public void forceLayout() 

Source Link

Document

Forces this view to be laid out during the next layout pass.

Usage

From source file:de.cachebox_test.splash.java

private void startInitial() {

    // show wait dialog if not running
    if (pWaitD == null)
        showPleaseWaitDialog();/*from  w w  w.  java2s .c  o m*/

    // saved workPath found -> use this
    Thread thread = new Thread() {

        @Override
        public void run() {
            // wait for measure layout

            final FrameLayout frame = (FrameLayout) findViewById(R.id.frameLayout1);
            width = frame.getMeasuredWidth();
            height = frame.getMeasuredHeight();

            while (width == 0 || height == 0) {
                splash.this.runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        frame.forceLayout();
                    }
                });
                try {
                    Thread.sleep(100);
                } catch (InterruptedException e) {
                }
                width = frame.getMeasuredWidth();
                height = frame.getMeasuredHeight();
            }

            // lolipop ask write permission
            if (android.os.Build.VERSION.SDK_INT > 20) {
                Initial(width, height);

                // Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
                // startActivityForResult(intent, 42);
            } else {
                Initial(width, height);
            }

        }
    };

    thread.start();

}