Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

opposite of setContentView

in my Activity subclass OnCreate method i use setContentView(XXX) to setup the window layout. In certain circumstances it is necessary, at 'OnStart' time, for this Activity to be stopped. Calling in the OnStart the Activity.finish() method, actually stop the execution but cause a ugly flicker effect where my layout is shown for an instant before application dies.

Question is: is there an opposite of setContentView? Can I use an ipotetic clearContentView to empty the layout and avoid the flickering?

Thanks in advance L.

like image 942
lorenzoff Avatar asked Sep 09 '11 12:09

lorenzoff


People also ask

What is SetContentView?

SetContentView is used to fill the window with the UI provided from layout file incase of setContentView(R. layout. somae_file). Here layoutfile is inflated to view and added to the Activity context(Window).

What is the different between SetContentView () function and startActivity () function?

So, with respect to time, setContentView alone is faster, since it doesn't start a new activity. Hence, your app will show the new screen faster... On the other hand, if you call startActivity, this activity is put on the stack, so you can go back by pressing the back button.

Why do we need to call SetContentView () in onCreate ()?

As onCreate() of an Activity is called only once, this is the point where most initialization should go: calling setContentView(int) to inflate the activity's UI, using findViewById to programmatically interact with widgets in the UI, calling managedQuery(android.


1 Answers

You can make a clean xml clear.xml with no content and

setContentView(clear); 

You can try, but i'm not sure it'll help .

like image 170
Finn Larsen Avatar answered Oct 23 '22 10:10

Finn Larsen