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 doesn't work as the intent isn't the parent view while the activity containing the TabHost is the parent View, Now I need to know how do I Set the whole app. to FullScreen mode or how to Refer to the Parent Activity to Set the full screen mode through it.
Here's a snippet of my code
public class MainActivity extends TabActivity {
public void toggleFullScreen(){
// This has the code to set App. to full screen
}
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent myIntent = new Intent(this, MywebviewActivity.class);
tabHost.addTab(
tabHost.newTabSpec("SomeName")
.setIndicator("Some Title")
.setContent( myIntents ));
Now I need to set fullscreen mode from "MywebviewActivity" not from my MainActivity
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);
}
modify code in your MainActivity
as following
Intent myIntent = new Intent(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 :
public void onCreate(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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.