Skip to content Skip to sidebar Skip to footer

How To Set The Application To Fullscreen From An Intent, Not From The Main Activity

My Application Has 4 Tabs, Each tab creates a subview ( intent ) now I have a handler for options/menu button within each intent , of the menu items is 'Toggle Fullscreen' this doe

Solution 1:

modify code in your MainActivity as following

Intent myIntent = newIntent(this, MywebviewActivity.class);

 intent.putExtra("isFullScreen", true);

now in onCreate() method of MywebviewActivity write code as following

put "setContentView(R.layout.main);" method below of this code as following :

publicvoidonCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);

    Intent intent=getIntent();
    boolean isfullScreen =  intent.getBooleanExtra("isFullScreen", false);


        if(isfullScreen )
        {
            requestWindowFeature(Window.FEATURE_NO_TITLE);
            getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                    WindowManager.LayoutParams.FLAG_FULLSCREEN);
        }

setContentView(R.layout.main);


}

not it will work

Solution 2:

check this

add this in your webview activity

    Intent i=getIntent();
    if(i!=null)
    {
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
    }

Post a Comment for "How To Set The Application To Fullscreen From An Intent, Not From The Main Activity"